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

动态按钮生成器(下)

程序员文章站 2022-03-10 14:58:25
由于内容超长,只好分2次贴出,以下为下半部分:images.length+=1;for(var b=images.options.length-1;b>g;b--){images.opti...
由于内容超长,只好分2次贴出,以下为下半部分:
images.length+=1;for(var b=images.options.length-1;b>g;b--)
{images.options[b].text=images.options[b-1].text;}images.options[g+1].text=imagi[g+1].name;cleanboxes(window.document.mouseoverform);}}}else
{if(images.length!=0)
{var g=-1;var r=no_of_images;imagi[r]=new imageobject(imagi[r-1].name,imagi[r-1].offsrcpro,imagi[r-1].offsrc,imagi[r-1].onsrcpro,imagi[r-1].onsrc,imagi[r-1].width,imagi[r-1].height,imagi[r-1].alt,imagi[r-1].border,imagi[r-1].url,imagi[r-1].linktarget);for(var p=imagi.length-2;p>g;p--)
{imagi[p].name=imagi[p-1].name;imagi[p].offsrcpro=imagi[p-1].offsrcpro;imagi[p].offsrc=imagi[p-1].offsrc;imagi[p].onsrcpro=imagi[p-1].onsrcpro;imagi[p].onsrc=imagi[p-1].onsrc;imagi[p].width=imagi[p-1].width;imagi[p].height=imagi[p-1].height;imagi[p].alt=imagi[p-1].alt;imagi[p].border=imagi[p-1].border;imagi[p].url=imagi[p-1].url;imagi[p].linktarget=imagi[p-1].linktarget;}
imagi[g+1].url=urlbox.value;imagi[g+1].linktarget=targetbox.value;imagi[g+1].name=namebox.value;imagi[g+1].offsrcpro=headsrc1.value;imagi[g+1].onsrcpro=headsrc2.value;imagi[g+1].offsrc=srcbox1.value;imagi[g+1].onsrc=srcbox2.value;imagi[g+1].width=widthbox.value;imagi[g+1].height=heightbox.value;imagi[g+1].alt=altbox.value;imagi[g+1].border=borderbox.value;no_of_images++;
images.length+=1;for(var b=images.options.length-1;b>g;b--)
{images.options[b].text=images.options[b-1].text;}images.options[g+1].text=imagi[g+1].name;cleanboxes(window.document.mouseoverform);}else
alert("缺少项目!")
}}}function checkit(array,string){if(array==null||array=="")
variable="";else
variable=string+array+""";return variable;}function generateit() {if (document.mouseoverform.images.length != 0) {headcode = "<script language="javascript">" + "<" + "!-" + "-hide";headcode += "//";headcode += "function iscompatible()" + "{" + "var browsername=navigator.appname;" + "var browserver=parseint(navigator.appversion);" + "var compatible=(browsername=="netscape"&&browserver==3)||(browsername=="netscape"||browserver==4)||(browsername=="microsoft internet explorer"||browserver==4)" + "return compatible;" + "}";headcode += "function flipit(img,tothis)" + "{" + "if(iscompatible())" + "{" + "img.src=tothis.src;" + "}" + "}";bodycode = "";for (var count = 0; count < imagi.length; count++) {var xname = imagi[count].name;var xnameoff = imagi[count].offsrcpro + imagi[count].offsrc;var xnameon = imagi[count].onsrcpro + imagi[count].onsrc;var target = checkit(imagi[count].linktarget, "target="");var border=checkit(imagi[count].border," border="");var alt = checkit(imagi[count].alt, "alt="\");var width=checkit(imagi[count].width," width="");var height = checkit(imagi[count].height, "height="");var mouseover="onmouseover="flipit(document." + xname + "," + xname + "on);"";
var mouseout="onmouseout="flipit(document." + xname + "," + xname + "off);"";
headcode+=xname+"off = new image();";headcode+=xname+"off.src = "+""" + xnameoff + "";"+"";headcode+=xname+"on = new image();";headcode+=xname+"on.src = "+""" + xnameon + "";"+"";bodycode+="<a href=""+ imagi[count].url + """+target+" "+mouseover+" "+mouseout+"><img src="" + xnameoff + "" name="" + xname + """+border+alt+width+height+"></a>";}headcode+="/"+"/end hide-"+"->";emulate=window.open("","codewindow","width=640,height=420,status=yes,resizable=yes,scrollbars=yes");emulate.document.clear();emulate.document.write(<html><head><title>code generated</title></head><body bgcolor="#ffffff" text="#000000" link="#000099" vlink="#663366" alink="#ff0000">);emulate.document.write("<br><br><center><font face="宋体">如下代码拷贝到<font color="red">head</font>标签间</font></center><form name="gencode"><center><textarea cols=55 rows=16 name="head" wrap="virtual"></textarea><p><font face="宋体">如下代码拷贝到<font color="red">body </font>标签间</font><p><textarea cols=55 rows=16 name="body" wrap="virtual"></textarea><p><input type="button" value="close " onclick="window.close();"></center></form><br>");emulate.document.write(<br><hr width=610 noshade></body></html>);