您现在的位置: 军旅同心-旅游自驾-军旅文学 >> 读书赏析 >> 学习园地 >> 电脑网络 >> 技术文章 >> 正文
动态按钮生成器(下)
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005-9-10 13:18:10
由于内容超长,只好分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 += "//http://www.njcatv.net/javascript/dai5.htm ";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>');
Emulate.document.genCode.Head.value=HeadCode;Emulate.document.genCode.Body.value=BodyCode;Emulate.document.close();}else
alert("You haven't made anything yet");
}
//End Hide-->
</script><title>New Page 1</title></head><body><table width=610 cellpadding=0 cellspacing=0 border=0><tr><td align=center><form name=mouseOverForm><table cellspacing=0 cellpadding=0 border=1 width=580><tr><td bgcolor=royalblue><font face="verdana, arial, helvetica" color=#ffffff size=-1> <b>Images</b></font></td><td bgcolor=#ffcf1f rowspan=6></td><td rowspan=6 valign=top><table cellspacing=0 cellpadding=0 border=0><tr><td bgcolor=royalblue><font face="verdana, arial, helvetica" color=#ffffff size=-1><b>MouseOut Image Source</b></font></td></tr><tr><td><table><tr><td><select name=Header1 onChange="headerSelect(document.mouseOverForm.Header1, document.mouseOverForm.HeadSrc1);"><option>None</option><option>file:///</option><option>http://</option></select><br><input type=Text value= name=HeadSrc1 size=8><input type=Text value= name=SrcBox1 size=22 onBlur=CheckAndChange(1);><input type=Button value="Hard Drive" name=SrcBox1but onClick=PopDrive(1);><br><br></td></tr></table></td></tr><tr><td bgcolor=royalblue><font face="verdana, arial, helvetica" color=#ffffff size=-1> <b>MouseOver Image Source</b></font></td></tr><tr><td><table><tr><td><select name=Header2 onChange="headerSelect(document.mouseOverForm.Header2, document.mouseOverForm.HeadSrc2);"> <option>None</option> <option>file:///</option> <option>http://</option> </select><br> <input type=Text value= name=HeadSrc2 size=8> <input type=Text value= name=SrcBox2 size=22 onBlur=CheckAndChange(2);> <input type=Button value="Hard Drive" name=SrcBox2but onClick=PopDrive(2);> <br><br> </td> </tr> </table> </td> </tr> <tr> <td bgcolor=royalblue> <font face="verdana, arial, helvetica" color=#ffffff size=-1> <b>Control Panel</b></font> </td> </tr> <tr> <td> <table cellspacing=0 cellpadding=0 border=0> <tr> <td> <input type=Button value="Add image" name=Insert onClick=CheckAndChange(1);CheckAndChange(2);insertItem();> </td> <td> <input type=Button value="Add image below" name=InsertBelow onClick=InsertBelow();> </td> <td> </tr> <tr> <td> <input type=Button value="Update image" name=Update onClick=UpdateOption();> </td> <td> <input type=Button value="Remove image" name=Remove onClick=removeIt();> </td> </tr> <tr> <td> <input type=Button value="Clean fields" name=Clean onClick=CleanBoxes(window.document.mouseOverForm)> </td> <td> <input type=Button value="Generate Code!" name=Generate onClick=generateIt();> </td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> <table cellspacing=0 cellpadding=5 border=0> <tr> <td> <select width=240 size=6 onChange=checkAndShow() name=Images> <option>Please be patient while loading </select> </td> </tr> </table> </td> </tr> <tr> <td> <table cellspacing=0 cellpadding=5 border=0> <tr> <td> <font face="helvetica, arial, sans serif" size=-1><b>Create the image as a link to: </b></font><br> <input type=Text value=http:// name=URLBox size=34> </td> </tr> </table> </td> </tr> <tr> <td> <table cellspacing=0 cellpadding=5 border=0> <tr> <td> <font face="helvetica, arial, sans serif" size=-1><b>Target</b><font face="helvetica, arial, sans serif" size=-2><b> (for frames only)</b></font><b>:</b></font> <br> <input type=Text value= name=TargetBox size=25> </td> </tr> </table> </

[1] [2] 下一页


更多
免责声明:作品版权归所属媒体与作者所有!!本站刊载此文不代表同意其说法或描述,仅为提供更多信息。如果您认为我们侵犯了您的版权,请告知!本站立即删除。有异议请联系我们。
文章录入:烟灰缸    责任编辑:烟灰缸 
  • 上一篇文章:
  • 下一篇文章:
  • 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 网站地图 | 版权申明 | 网站公告 | 管理登录 |