有时候为了测试正则表达式、临时自己写了这么一个、我对于JS也不懂、所以写的很差、、
代码:(我测试在IE8中是正常的、然而在我的FireFox中的、却无法使用、原因不明、这个我也不管了、反正就自己用用而已)
<
HTML
>
< HEAD >
< Title > 正则表达式测试工具——JavaScript RegExp引擎</Title >
< META http-equiv = "Content-Type" content = "text/html; charset=gb2312" >
< META name = "Generator" content = "Asp Studio 1.0" >
</ HEAD >
< BODY onKeyDown = ChkTest ( event ) >
<!-- 请在这里输入您的HTML代码 -->
< table width = "90%" >
< tr width = "100%" >
< th width = "50%" >
< label > 正则字符</label >
</ th >
< th width = "50%" >
< label > 匹配字符</label >
</ th >
</ tr >
< tr width = "100%" >
< td width = "50%" >
< p align = "center" >
< TEXTAREA rows = "15" cols = "40" id = "RegEx" > 这里输入正则匹配式 </ TEXTAREA >
</ p >
</ td >
< td width = "50%" >
< p align = "center" >
< TEXTAREA rows = "15" cols = "40" id = "Subject" > 这里输入等待匹配的字符</TEXTAREA >
</ p >
</ td >
</ tr >
< tr width = "100%" align = "center" >
< td width = "50%" >
< label > < INPUT type = "checkbox" ID = "Checkbox1" NAME = "Checkbox1" > 忽略大小写</label >
< label > < INPUT type = "checkbox" ID = "Checkbox2" NAME = "Checkbox2" > 单行模式</label >
< label > < INPUT type = "checkbox" ID = "Checkbox3" NAME = "Checkbox3" > 多行模式</label > < br >
< label > < INPUT type = "checkbox" ID = "Checkbox4" NAME = "Checkbox4" > 全局模式</label >
< label > < INPUT type = "checkbox" ID = "Checkbox5" NAME = "Checkbox5" > 扩展模式</label >
</ td >
< td width = "50%" >
< INPUT align = "center" type = "button" value = "验证" ID=" Button1 " NAME=" Button1 " onClick=RegTest();>
<label>Ctrl + Enter可快速验证</label>
</td>
</tr>
</table>
<Script language=" vbscript ">
//请在这里输入您的Javascript代码
function getOption()
dim i,objCheck
for i=1 to 5
objCheck=document.getElementById(" CheckBox " & i)
if objCheck.value <> 0 then
msgbox " ok "
end if
next
end function
</Script>
<Script language=" vbscript ">
//请在这里输入您的Javascript代码
function getOption()
dim i,objCheck
for i=1 to 5
objCheck=document.getElementById(" CheckBox " & i)
if objCheck.value <> 0 then
msgbox " ok "
end if
next
end function
</Script>
<Script language=" Javascript ">
function RegTest(){
var i=1;
var Obj;
var s;
for (i=1;i <6;i++)
{
Obj=document.getElementById(" CheckBox " + i);
if (Obj.checked)
{
if (i == 1 ) s=" i ";
if (i == 3 ) s=s + " m ";
if (i == 4 ) s=s + " g ";
}
}
var re = new RegExp(window.document.getElementById(" RegEx ").value, s);
// 查找
var mresult = re.exec(window.document.getElementById(" Subject ").value);
if( mresult != null )
{
alert(" 找到了: " + mresult);
}
else
{
alert(" 没有匹配式");
}
}
function ChkTest ( keys )
{
if ( keys . ctrlKey && keys . keyCode == 13 ) RegTest ();
}
</ Script >
</ body >
</ html >
< HEAD >
< Title > 正则表达式测试工具——JavaScript RegExp引擎</Title >
< META http-equiv = "Content-Type" content = "text/html; charset=gb2312" >
< META name = "Generator" content = "Asp Studio 1.0" >
</ HEAD >
< BODY onKeyDown = ChkTest ( event ) >
<!-- 请在这里输入您的HTML代码 -->
< table width = "90%" >
< tr width = "100%" >
< th width = "50%" >
< label > 正则字符</label >
</ th >
< th width = "50%" >
< label > 匹配字符</label >
</ th >
</ tr >
< tr width = "100%" >
< td width = "50%" >
< p align = "center" >
< TEXTAREA rows = "15" cols = "40" id = "RegEx" > 这里输入正则匹配式 </ TEXTAREA >
</ p >
</ td >
< td width = "50%" >
< p align = "center" >
< TEXTAREA rows = "15" cols = "40" id = "Subject" > 这里输入等待匹配的字符</TEXTAREA >
</ p >
</ td >
</ tr >
< tr width = "100%" align = "center" >
< td width = "50%" >
< label > < INPUT type = "checkbox" ID = "Checkbox1" NAME = "Checkbox1" > 忽略大小写</label >
< label > < INPUT type = "checkbox" ID = "Checkbox2" NAME = "Checkbox2" > 单行模式</label >
< label > < INPUT type = "checkbox" ID = "Checkbox3" NAME = "Checkbox3" > 多行模式</label > < br >
< label > < INPUT type = "checkbox" ID = "Checkbox4" NAME = "Checkbox4" > 全局模式</label >
< label > < INPUT type = "checkbox" ID = "Checkbox5" NAME = "Checkbox5" > 扩展模式</label >
</ td >
< td width = "50%" >
< INPUT align = "center" type = "button" value = "验证" ID=" Button1 " NAME=" Button1 " onClick=RegTest();>
<label>Ctrl + Enter可快速验证</label>
</td>
</tr>
</table>
<Script language=" vbscript ">
//请在这里输入您的Javascript代码
function getOption()
dim i,objCheck
for i=1 to 5
objCheck=document.getElementById(" CheckBox " & i)
if objCheck.value <> 0 then
msgbox " ok "
end if
next
end function
</Script>
<Script language=" vbscript ">
//请在这里输入您的Javascript代码
function getOption()
dim i,objCheck
for i=1 to 5
objCheck=document.getElementById(" CheckBox " & i)
if objCheck.value <> 0 then
msgbox " ok "
end if
next
end function
</Script>
<Script language=" Javascript ">
function RegTest(){
var i=1;
var Obj;
var s;
for (i=1;i <6;i++)
{
Obj=document.getElementById(" CheckBox " + i);
if (Obj.checked)
{
if (i == 1 ) s=" i ";
if (i == 3 ) s=s + " m ";
if (i == 4 ) s=s + " g ";
}
}
var re = new RegExp(window.document.getElementById(" RegEx ").value, s);
// 查找
var mresult = re.exec(window.document.getElementById(" Subject ").value);
if( mresult != null )
{
alert(" 找到了: " + mresult);
}
else
{
alert(" 没有匹配式");
}
}
function ChkTest ( keys )
{
if ( keys . ctrlKey && keys . keyCode == 13 ) RegTest ();
}
</ Script >
</ body >
</ html >
My New Blog : http://blog.fdlife.info/
The more you know, the less you believe.