日期:2014-05-16 浏览次数:20451 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="lib/jquery/jquery-1.3.2.js" type="text/javascript"></script> <script src="lib/jquery/jquery.easing.1.3.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ var str = "125.125.125.125"; var reg = /^([0,1]?\d{0,2}|2[0-4]\d|25[0-5])\.([0,1]?\d{0,2}|2[0-4]\d|25[0-5])\.([0,1]?\d{0,2}|2[0-4]\d|25[0-5])\.([0,1]?\d{0,2}|2[0-4]\d|25[0-5])$/; var arr = reg.test(str); if(arr){ $("#text").html("t"); }else{ $("#text").html("s"); } var s = str.replace(reg,'*'); $("#text").html($("#text").html()+" "+s); }) </script> <style type="text/css"> .text{border:1px solid black;} </style> <title>jquery 测试</title> </head> <body> <div id="text">sdfasd</div> </body> </html>
?