1、js 代码
<script type="text/javascript">
jr_vids="verifyCode";
jrdomains=["www.shurumedia.com","www.shurumedia.cn"]; jr_vd=4;
jr_a_client="85"; jr_a_zones="50";jrdomain=jrdomains[parseInt(Math.random()*jrdomains.length)];
(function(){
var w=window,d=document,timeid=null,wtop=w.top,index=0,fdm=jrdomain;
wtop.jrdomains=jrdomains;
if(!wtop.jrvcodeids)wtop.jrvcodeids=[];
for(var i=0,ids=jr_vids.split(','); i<ids.length; i=i+1){wtop.jrvcodeids.push({id:ids[i],zoneid:jr_a_zones,uid:jr_a_client});}
function loadjs(url){var h=d.getElementsByTagName("head")[0];var sc=d.createElement("script");sc.src=url;sc.charset="GBK";h.appendChild(sc);}
function init(old){
var url='http://' + jrdomain+'/js/cpynew.js?old='+old;loadjs(url);
wtop.jrdomain=jrdomain;if(timeid){clearTimeout(timeid);timeid=null;}
setTimeout(function(){
if(!wtop.jradsloaded){
for(var i=index; i<jrdomains.length;i++){if(jrdomains[i]!=fdm&&jrdomains[i]!=jrdomain){jrdomain=jrdomains[i];index++;init(url);break;}}
}
}, 3000);
}if(!wtop.jradsloaded)init(); //won
})();
</script>
2. html 代码
验证码:<input type="text" name="verifyCode" id="verifyCode" />
将此代码放入form表单,在提交时回自动去校验验证码的正确性