我还帮你测试了一下,也觉得奇怪,隔一次true一次:
<script>
var reg = /^\d*$/ig;
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
</script>
<script>
var reg = /^\d*$/ig;
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
document.write( reg.test( "123" ) );
</script>
解决方案 »
- 谁会重写htmleditor的工具栏,我想在工具栏上添加一个自定义的按钮
- |zyciis| 在Jquery中 我想要获取当前对像时用$(this)不行,这样会返回jquery,我用$(this)也不行,要怎么办啊,谢谢
- 请问怎样判断当前得到的对象是否是表格对象?谢谢!
- 只有450K的搜索软件,完全基于javascript,支持无刷新.欢迎大家测试,同时也希望和大家一起讨论
- JS中文件名的字符分割问题!希望高手指点
- 高人进来!!分不够狂加,直到解决问题位置 如何检测到Alt+F4,还有就是如何在不同的浏览器里检测关闭事件
- alert 小问题!
- arguments和命名参数
- 怎样全选checkbox?
- 求大牛帮忙,写出解密功能函数对应的加密函数
- 点击表格行,checkbox自动选中的问题
- window.open()不显示地址栏
<script type="text/javascript">
var reg = /^\d*$/ig; document.write("Match from : ")
document.write(reg.lastIndex+"<br>");
document.write("The result is : ");
document.write(reg.test( "123")+"<br>");
document.write("Since you use the g Mode,then the next match will start from : ")
document.write(reg.lastIndex+"<br>");
document.write("Then the result is : ")
document.write(reg.test( "123")+"<br>");
document.write("And Finally the Match index will be reset to :");
document.write(reg.lastIndex);document.write("<br><br>");
//Set the init Match index
reg.lastIndex = 3;
document.write("the reseted Match index is :");
document.write(reg.lastIndex+"<br>");
document.write("So the result will be : ")
document.write(reg.test( "123")+"<br>"); </script>