function trim(inputstr) //Remove spaces. Before obtaining the form information entered by the client, trim before submitting. For example: "form1.org_name.value = trim(form1.org_name.value); " { if(!inputstr.length>0) return ""; var starts=0; var ends=inputstr.length; while(starts{ if(inputstr.substring(starts,starts 1)==" ") starts ; else break; } while(starts{ if(inputstr.substring(ends-1,ends)==" ") ends--; else break; } return inputstr.substring(starts,ends); }
function isvalidcode(inputs) //校验邮政编码 { var i,temp; var isvalidcode = true; inputstr=trim(inputs); if(inputstr.length==null||inputstr.length==0||inputstr.length!=6) return false; for(i=0;i{ temp=inputstr.substring(i,i 1);
function isvalidzgh(inputs) //Verification 8-digit employee number (that is, it can only be a string of English letters and numbers) { var i,temp; var isvalidzgh = true; inputstr=trim(inputs); if(inputstr.length==null || inputstr.length==0 || inputstr.length != 8) return false; for(i=0;i{ temp=inputstr.substring(i,i 1);
function isvalidxh(inputs) //Verify the 7-digit student number (that is, it can only be a string of English letters and numbers) { var i,temp; var isvalidxh = true; inputstr=trim(inputs); if(inputstr.length==null || inputstr.length==0 || inputstr. length != 7) return false; for(i=0;i{ temp=inputstr.substring(i,i 1);
function isvalidkcid(inputs) //Verify the 5-digit course number (that is, it can only be a string of numbers) { var i,temp; var isvalidkcid = true; inputstr=trim (inputs); if(inputstr.length==null||inputstr.length==0||inputstr.length!=5) return false; for(i=0;i{ temp=inputstr.substring(i,i 1);
if(!(temp>="0" && temp<="9")) { isvalidkcid=false; break; } } return isvalidkcid; (That is, it can only be a string of English letters and numbers) { var i,temp; var isvalidname = true; inputstr=trim(inputs); if(inputstr. length==null || inputstr.length==0 || inputstr.length > 20 || inputstr.length < 4) return false; for(i=0;i{ temp=inputstr.substring(i,i 1);
Test code window" outputs.value); } //Use shortcut key F12 to preview document.onkeydown=seeHtms function seeHtms() { if((event.keyCode==123)) { open( ).document.write("Test code window" outputs.value); } } //Select all codes function ta() { outputs.select() } //Copy code function tc() { document.execCommand("Copy") } //Paste code function tp() { outputs.focus() document.execCommand("Paste") }
A collection of advertising JS code effects 1.[Normal effect] Nowadays, many website advertisements are in full swing. Now I will introduce the code usage of common couplet floating advertising effect. The effect introduced can be displayed normally at the resolution of 1024*768 and can be displayed at the resolution of 800*600. Automatically hide so as not to cover the page and affect visitors’ browsing content. The following is the code required to achieve the effect:
var delta=0.015 var collection; function floaters() { this.items = []; this.addItem = function(id,x,y,content) { document.write('
var theFloaters = new floaters(); theFloaters.addItem('followp1','document.body.clientWidth -100',0,' theFloaters.addItem('followp2',0,0,' ' target=_blank); theFloaters.play();
Save the above code as a JS file, and then use it when you want to achieve this effect Just call the page! Pay attention to modifying the ad image address and link address!
Comprehensive list of advertising JS code effects ~~~~~~~~~~
2.[Mouse sensor] The difference from the previous code is that when the mouse moves over the advertising image, it can sense and display the advertising large image effect set separately. The following is the code required to achieve the effect:
function bigshow(){ document.all.p_250.style.visibility = 'visible'; document.all.p_80.style.visibility = 'hidden'; } function bigide(){ document.all. p_80.style.visibility = 'visible'; document.all.p_250.style.visibility = 'hidden'; }
var ad_80= new Array(1); var ad_250= new Array(1);
ad_80[0]=""; ad_250[0]="";
var imgheight; var fubioleft; window.screen.width>800 ? fubioleft=15:fubioleft =15
document.write('
');
ad_now = new Date(); ad_id= ad_now.getSeconds() %1
var theFloaters = new floaters(); // theFloaters.addItem('followp1','document.body.clientWidth-100',0,'
'); theFloaters.addItem('followp2',0,0,'
'); theFloaters.play();
把上面的代码分别另存为两个JS文件,然后在想实现此效果的页面用
调用即可,*代表你另存的文件名!注意修改广告图片地址和连接地址!
广告JS代码效果大全 ~~~~~~~~~~
4.[浮动对联广告---之左侧代码]
如果您想只有一侧显示的话,下面是实现左侧效果所需代码:
var ad_float_left_src ="图片地址"; var ad_float_left_url ="地址"; var ad_float_left_type = ""; document.ns = navigator.appName == "Microsoft Internet Explorer"
var imgheight_close var imgleft window.screen.width>800 ? imgheight_close=120:imgheight_close=120 window.screen.width>800 ? imgleft=8:imgleft=122 function myload() { myleft.style.top=document.body.scrollTop document.body.offsetHeigh t-imgheight_close; myleft.style.left=imgleft; leftmove(); } function leftmove() { myleft.style.top=document.body.scrollTop document.body.offsetHeigh t-imgheight_close; myleft.style.left=imgleft; setTimeout("leftmove();",50) }
function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&& (parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight! =document.MM_pgH) location.reload(); } MM_reloadPage(true)
function close_float_left(){ myleft.style.visibility='hidden'; }
var _c = 0; var _i = 0; var _v = 0; var _l = 0; var _sf = 3000; var _html = null; var _image = null; var _mycars= new Array(); var _w = new Array(); var _h = new Array();
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn