欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

动态按钮生成器(上)

程序员文章站 2022-03-10 14:59:07
很cool的,大家一起来研究研究! 很cool的,大家一起来研究研究!
<html><head><meta http-equiv=content-type content="text/html; charset=gb2312"><script language="javascript">
<!--hide
//timer
speed=10;//array to make objects
imagi=new array();//numbers of link
no_of_images=0;currentimage=-1;function checkbrowser(){var bname=navigator.appname;var ver=parseint(navigator.appversion);if(bname=="netscape"&&ver>=3||bname=="microsoft internet explorer"&&ver>=4);else{alert(you need netscape navigator 3 and above or microsoft internet explorer 4 and above)
}}checkbrowser();//the image object
function imageobject(name,offsrcpro,offsrc,onsrcpro,onsrc,width,height,alt,border,url,linktarget){this.name=name;this.offsrcpro=offsrcpro;this.offsrc=offsrc;this.onsrcpro=onsrcpro;this.onsrc=onsrc;this.width=width;this.height=height;this.alt=alt;this.border=border;this.url=url;this.linktarget=linktarget;this.length=11;}function headerselect(grut,grutv){if(grut.options[0].selected){grutv.value="";}else{for(var y=0;y<grut.length;y++){if(grut.options[y].selected){grutv.value="";grutv.value+=grut.options[y].text;}}}}//function performing form validation
function checkme(me){with(me){srcbox1.focus();srcbox1.blur();srcbox2.focus();srcbox2.blur();if(urlbox.value=="https://"||urlbox.value==""){alert("连接的url没有设置");
urlbox.focus();
return false;
}if(srcbox1.value==""){alert("mouseout图片尚未设置");
srcbox1.focus();
return false;
}if(srcbox2.value==""){
alert("mouseover图片尚未设置");
srcbox2.focus();
return false;
}
if(namebox.value==""){
alert("图片尚未命名");
namebox.focus();
return false;
}
return true;}}
function checkandshow(){
with(window.document.mouseoverform.images){if(options.length!=0){for(var i=0;i<options.length;i++){if(options[i].selected){with(window.document.mouseoverform){urlbox.value=imagi[i].url;targetbox.value=imagi[i].linktarget;headsrc1.value=imagi[i].offsrcpro;headsrc2.value=imagi[i].onsrcpro;srcbox1.value=imagi[i].offsrc;srcbox2.value=imagi[i].onsrc;namebox.value=imagi[i].name;borderbox.value=imagi[i].border
altbox.value=imagi[i].alt;widthbox.value=imagi[i].width;heightbox.value=imagi[i].height;currentimage=i;if(headsrc1.value=="file:///")
header1.options[1].selected=true;else if(headsrc1.value=="https://")
header1.options[2].selected=true;else if(headsrc1.value=="")
header1.options[0].selected=true;if(headsrc2.value=="file:///")
header2.options[1].selected=true;else if(headsrc2.value=="https://")
header2.options[2].selected=true;else if(headsrc2.value=="")
header2.options[0].selected=true;}}}}
}
}function insertitem(){with(window.document.mouseoverform){if(checkme(window.document.mouseoverform)){imagi[no_of_images]=new imageobject(namebox.value,headsrc1.value,srcbox1.value,headsrc2.value,srcbox2.value,widthbox.value,heightbox.value,altbox.value,borderbox.value,urlbox.value,targetbox.value);images.length+=1;images.options[images.length-1].text=imagi[no_of_images].name;++no_of_images;cleanboxes(window.document.mouseoverform);cleanboxes(window.document.mouseoverform);}}}//clean options[0] when page loaded