图片验证码
<!DOCTYPE html> <html> <head> <title>图片验证码</title> <meta charset="utf-8"> </head> <style type="text/css"> <!-- .style2 { color: #00FF00; font-weight: bold; font-size: 16px; } .style5 {color: #00FF00} --> </style> <body>
<div style="width: 500px;height: 250px;" id="div1"> <table width="265" height="110" border="1" align="center" bordercolor="#0000FF" id="form"> <tr> <td width="90"><span class="style5">用户名</span></td> <td width="169"><input name="textfield" type="text"></td> </tr> <tr> <td><span class="style5">密 码</span></td> <td><input name="textfield2" type="text"></td> </tr> <tr> <td><span class="style5">确认密码</span></td> <td><input name="textfield3" type="text"></td> </tr> <tr> <td colspan="2"><div align="center"> <input name="Submit2" type="button" value="保存"> <input name="Button" type="button" value="取消"> </td> </tr> </table> </div> <script type="text/javascript"> var img=""; var source=['0','1','2','3','4']; var t=null; t=setTimeout(change,1000);//一秒换一张背景图 function change(){ clearTimeout(t); var n=Math.floor(Math.random()*source.length); var s=source[n]; var div1=document.getElementById("div1"); div1.style.backgroundImage="url('Images/"+s+".jpg')"; t=setTimeout(change,1000); } </script> </body> </html>