摘要: 第一次发现JavaScript中replace()方法如果直接用str.replace("-","!")只会替换第一个匹配的字符. 而str.replace(/\-/g,"!")则可以全部替换掉匹配的字符(g为全局标志)。replace() Thereplace()methodreturnsthestringthatresultswhenyoureplacetextmatchingitsfirstargument (aregularexpression)withthetextofthesecondargument(astring). 阅读全文
posted @ 2012-02-22 19:04 tokeep 阅读(242) 评论(0) 推荐(0) 编辑
摘要: jQuery获取Select选择的Text和Value:语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text3. var checkValue=$("#select_id").val(); //获取Select选择的Value4. var check 阅读全文
posted @ 2012-02-22 19:02 tokeep 阅读(202) 评论(0) 推荐(0) 编辑