<STYLE type=text/css> body { text-align:center } table td { font-size:9pt; } </STYLE> <SCRIPT language=JavaScript> <!-- function fn_getValueRadio(form_name) { var value = ""; for (var i=0; i<form_name.length;i++) { if (form_name[i].checked) { value = form_name[i].value; break; } } return value; } function fn_display(form_name) { var display = fn_getValueRadio(form_name); if (display == "flash") { document.getElementById("image").style.display = "none" document.getElementById("imageUrl").style.display = "none" document.getElementById("flash").style.display = "" } else if (display == "image") { document.getElementById("image").style.display = "" document.getElementById("imageUrl").style.display = "" document.getElementById("flash").style.display = "none" } } function JM_cc(ob) { ob.select(); js=ob.createTextRange(); js.execCommand("Copy"); } function fn_createCode(form_name) { //生成飘动的层 var display = fn_getValueRadio(form_name.type); var div_html = ""; if (display == "image") { var imgPath = form_name.imgPath.value; var imgHeight = form_name.imgHeight.value; var imgWidth = form_name.imgWidth.value; var imgUrl = form_name.imgUrl.value; var mouse = fn_getValueRadio(form_name.mouse) if (imgPath == "") { alert("请输入飘动图片的路径") return; } if ((imgHeight == "")||((imgHeight != "")&&(!isNumber(imgHeight)))) { alert("图片的高度不能为空且只能为数字") return; } if ((imgWidth == "")||((imgWidth != "")&&(!isNumber(imgWidth)))) { alert("图片的宽度不能为空且只能为数字") return; } if (mouse == "1") { if (imgUrl != "") div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'><a href='"+imgUrl+"' target='_blank'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"' border='0'> </a></span>" else div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"'></span>" } else { if (imgUrl != "") div_html += "<span id='img' style='position:absolute;'><a href='"+imgUrl+"' target='_blank'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"' border='0'> </a></span>" else div_html += "<span id='img' style='position:absolute;'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"'></span>" } } else if (display == "flash") { var fPath = form_name.fPath.value; var fHeight = form_name.fHeight.value; var fWidth = form_name.fWidth.value; var fmouse = fn_getValueRadio(form_name.mouse) if (fPath == "") { alert("请输入飘动flash的路径") return; } if ((fHeight == "")||((fHeight != "")&&(!isNumber(fHeight)))) { alert("flash的高度不能为空且只能为数字") return; } if ((fWidth == "")||((fWidth != "")&&(!isNumber(fWidth)))) { alert("flash的宽度不能为空且只能为数字") return; } if (fmouse == "1") { div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'>"; div_html += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+fWidth+"' height='"+fHeight+"'>"; div_html += "<param name='movie' value='"+fPath+"'>"; div_html += "<param name='quality' value='high'>" div_html += "<embed src='"+fPath+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+fWidth+"' height='"+fHeight+"'></embed></object></span>"; } else { div_html += "<span id='img' style='position:absolute;'>"; div_html += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+fWidth+"' height='"+fHeight+"'>"; div_html += "<param name='movie' value='"+fPath+"'>"; div_html += "<param name='quality' value='high'>" div_html += "<embed src='"+fPath+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+fWidth+"' height='"+fHeight+"'></embed></object></span>"; } } //设置飘动参数生成飘动代码 var code_html = ""; var position = fn_getValueRadio(form_name.imgPosition); var xPos = 0; var yPos = 0; switch (position) { case "topLeft": xPos = 0; yPos = 0; break; case "topCenter": xPos = parseInt(document.body.clientWidth/2); yPos = 0; break; case "topRight": xPos = document.body.clientWidth; yPos = 0; break; case "bottomLeft": xPos = 0; yPos = document.body.clientHeight; break; case "bottomCenter": xPos = parseInt(document.body.clientWidth/2); yPos = document.body.clientHeight; break; case "bottomRight": xPos = document.body.clientWidth; yPos = document.body.clientHeight; break; } var delay_time = parseInt(fn_getValueRadio(form_name.delay)) var delay = 0; switch (delay_time) { case 5: delay = 5 break; case 10: delay = 10 break; case 20: delay = 20 break; case 30: delay =30 break; case 40: delay = 40 break; case 50: delay = 50 break; } code_html += "\r\n<script language='JavaScript'>\r\n" code_html += "var xPos = "+xPos+";var yPos = "+yPos+"; var step = 1;var delay = "+delay+";var height = 0; var Hoffset = 0;var Woffset = 0; var yon = 0;var xon = 0; var xon = 0; var interval;\r\n"; code_html += "var img = document.getElementById('img');\r\n" code_html += "img.style.top = "+yPos+";\r\n"; code_html +="function changePos(){\r\n" code_html += "width = document.body.clientWidth;\r\n" code_html += "height = document.body.clientHeight;\r\n" code_html += "Hoffset = img.offsetHeight;\r\n" code_html += "Woffset = img.offsetWidth;\r\n" code_html += "img.style.left = xPos + document.body.scrollLeft;\r\n" code_html += "img.style.top = yPos + document.body.scrollTop;\r\n" code_html += "if (yon) {\r\n" code_html += "yPos = yPos + step;\r\n" code_html += "\r\n}" code_html += "else {\r\n" code_html += "yPos = yPos - step;\r\n" code_html += "}\r\n" code_html += "if (yPos < 0) {\r\n" code_html += "yon = 1;\r\n" code_html += "yPos = 0;\r\n" code_html += "}\r\n" code_html += "if (yPos >= (height - Hoffset)) {\r\n" code_html += "yon = 0;\r\n" code_html += "yPos = (height - Hoffset);\r\n" code_html += "}\r\n" code_html += "if (xon) {\r\n" code_html += "xPos = xPos + step;\r\n" code_html += "}\r\n" code_html += "else {\r\n" code_html += "xPos = xPos - step;\r\n" code_html += "}\r\n" code_html += "if (xPos < 0) {\r\n" code_html += "xon = 1;\r\n" code_html += "xPos = 0;\r\n" code_html += "}\r\n" code_html += "if (xPos >= (width - Woffset)) {\r\n" code_html += "xon = 0;\r\n" code_html += "xPos = (width - Woffset);\r\n" code_html += "}\r\n" code_html += "}\r\n" code_html +="function start() {\r\n" code_html +="img.visibility = 'visible';\r\n" code_html +="interval = setInterval('changePos()', delay);\r\n" code_html +="}\r\n" code_html +="function mystop()\r\n" code_html +="{\r\n" code_html +="clearInterval(interval)\r\n" code_html +="}\r\n start()\r\n<\/script>" form_name.code.value = div_html + code_html; } function isNumber(value) { var desc = "0123456789"; for (var i = 0; i<value.length;i++) { if (desc.indexOf(value.charAt(i)) == -1) return false } return true; } --> </SCRIPT> <P><FONT size=4>图片flash随机飘动代码生成器 </FONT></P> <FORM name=createCode action="" method=post> <TABLE style="LINE-HEIGHT: 20px" cellSpacing=0 cellPadding=0 width=700 border=0> <TBODY> <TR> <TD width=119> </TD> <TD width=256> </TD> <TD colSpan=4> </TD></TR> <TR> <TD align=right width=119>飘动元素:</TD> <TD width=256><INPUT onclick=fn_display(createCode.type) type=radio CHECKED value=image name=type> 图片文件<INPUT onclick=fn_display(createCode.type) type=radio value=flash name=type> flash文件 </TD> <TD colSpan=4> </TD></TR> <TR id=image> <TD align=right>图片路径:</TD> <TD align=middle><INPUT style="WIDTH: 250px" name=imgPath></TD> <TD align=right width=60>图片高度</TD> <TD align=middle width=92><INPUT style="WIDTH: 80px" name=imgHeight></TD> <TD align=right width=67>图片宽度</TD> <TD align=middle width=106><INPUT style="WIDTH: 80px" name=imgWidth></TD></TR> <TR id=flash style="DISPLAY: none"> <TD align=right>flash路径:</TD> <TD align=middle><INPUT style="WIDTH: 250px" name=fPath></TD> <TD align=right width=60>flash高度</TD> <TD align=middle width=92><INPUT style="WIDTH: 80px" name=fHeight></TD> <TD align=right width=67>flash宽度</TD> <TD align=middle width=106><INPUT style="WIDTH: 80px" name=fWidth></TD></TR> <TR id=imageUrl> <TD align=right>图片链接:</TD> <TD align=middle><INPUT style="WIDTH: 250px" name=imgUrl></TD> <TD align=right colSpan=4> </TD></TR> <TR> <TD align=right height=16>图片首次出现位置:</TD> <TD colSpan=5><INPUT type=radio CHECKED value=topLeft name=imgPosition> 上左 <INPUT type=radio value=topCenter name=imgPosition> 上中 <INPUT type=radio value=topRight name=imgPosition> 上右 <INPUT type=radio value=bottomLeft name=imgPosition> 下左 <INPUT type=radio value=bottomCenter name=imgPosition> 下中 <INPUT type=radio value=bottomRight name=imgPosition> 下右 </TD></TR> <TR> <TD align=right>图片飘动延迟时间:</TD> <TD colSpan=5><INPUT type=radio value=5 name=delay> 5ms <INPUT type=radio CHECKED value=10 name=delay> 10ms <INPUT type=radio value=20 name=delay> 20ms <INPUT type=radio value=30 name=delay> 30ms <INPUT type=radio value=40 name=delay> 40ms <INPUT type=radio value=50 name=delay> 50ms</TD></TR> <TR> <TD vAlign=top align=right>鼠标事件:</TD> <TD vAlign=top align=left><INPUT type=radio CHECKED value=1 name=mouse> 是 <INPUT type=radio value=0 name=mouse> 否 </TD> <TD vAlign=top align=left colSpan=4>鼠标事件说明:<BR>当鼠标放在图片上时,图片飘动是否停止</TD></TR> <TR> <TD vAlign=top align=right> </TD> <TD vAlign=top align=left><INPUT onclick=fn_createCode(createCode) type=button value=生成代码 name=Button></TD> <TD vAlign=top align=left colSpan=4> </TD></TR></TBODY></TABLE> <TABLE cellSpacing=0 cellPadding=0 width=700 border=0> <TBODY> <TR> <TD width=81> </TD> <TD width=626><TEXTAREA name=code rows=15 cols=70></TEXTAREA></TD> <TD width=71> </TD></TR> <TR> <TD> </TD> <TD><INPUT onclick=JM_cc(code) type=button value=复制到剪切板 name=Button></TD> <TD> </TD></TR> <TR> <TD> </TD> <TD>将文本框中生成的代码拷贝到您的页面</TD> <TD> </TD></TR></TBODY></TABLE></FORM> <P><FONT size=4></FONT></P> |