注册
登录
标签
在线时间兑换积分
帮助
精品酷站论坛
»
JS,UI框架开发
» 代码生成/转换器
‹‹ 上一主题
|
下一主题 ››
发新话题
发布投票
发布商品
发布悬赏
发布活动
发布辩论
发布视频
打印
代码生成/转换器
junstudio
管理员
个人空间
发短消息
加为好友
当前离线
1
#
大
中
小
发表于 2007-6-18 14:20
只看该作者
代码生成/转换器
一个QQ菜单编辑器
<html> <head> <title>CreateCode</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="javascript"> //生成代码 function createCode() { totalheight = parseInt(fcreate.bodyheight.value) + fcreate.headheight.value * (fcreate.itemcount.value - 1); textCode.value = text1.value + "var headHeight = " + fcreate.headheight.value + ";" + "var bodyHeight = " + fcreate.bodyheight.value + ";" + "var objcount = " + fcreate.itemcount.value + ";" + "var step = " + fcreate.mspeed.value + ";" + text2.value + ".headtd1 { background: #" + fcreate.headcolorn.value + "; border: 2px outset; border-color: #" + fcreate.lbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.dbordern.value + " #" + fcreate.lbordern.value + "; cursor: hand; font-size: 9pt}" + ".headtd2 { background: #" + fcreate.headcolora.value + "; border: 2px outset; border-color: #" + fcreate.lbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.dbordera.value + " #" + fcreate.lbordera.value + "; cursor: hand; font-size: 9pt}" + ".bodytd { background: #" + fcreate.bodycolor.value + "; border: 2px outset; border-color: #" + fcreate.lborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.dborderb.value + " #" + fcreate.lborderb.value + "; font-size: 9pt}" + text3.value + "<div id='mainboard' style='position:absolute; left:2px; top:2px; width:120px; height:" + totalheight + "px; z-index:1; overflow: hidden; background: #" + fcreate.bodycolor.value + ";'> "; itemtop = 0; for (i = 1; i <= parseInt(fcreate.itemcount.value); i++) { textCode.value += "<div id='item" + i + "body' style='position:absolute; left:0; top:" + itemtop + "; width:120px; height:" + fcreate.bodyheight.value + "px; z-index:" + (i+1) +"; overflow: hidden'>" + "<table width='100%' border='0' height='100%' cellpadding='2' cellspacing='0'>" + "<tr>" + "<td id='item" + i + "head' height='" + (fcreate.headheight.value-2) + "' class="; if (i == 1) textCode.value += "'headtd2'"; else textCode.value += "'headtd1'"; textCode.value += " onclick='showme(item" + i + "body,this)' align='center'>"; //textCode.value += getValue("fcreate.item" + i); textCode.value +=document.all["item"+i].value+"</td>"+ "</tr>" + "<tr>" + "<td class='bodytd' align='center'>" + "test" + "</td>" + "</tr>" + "</table>" + "</div>"; if (i == 1) itemtop += parseInt(fcreate.bodyheight.value); else itemtop += parseInt(fcreate.headheight.value); } textCode.value += "</div></body></html>" } //获取对象的值 function getValue(obj) { //obj = Object(obj); return obj.value; } //清空代码 function clearCode() { textCode.value = ""; } //预览代码 function prevCode() { createCode(); open().document.write(textCode.value); } //选择代码 function selectCode() { textCode.select(); } //根据
输入
的数字,自动生成子菜单的填写项 function checkItems() { if ((fcreate.itemcount.value.length > 0 && isNaN(fcreate.itemcount.value)) || fcreate.itemcount.value.length == 0) { alert("请
输入
数字!"); fcreate.itemcount.focus(); } else { if (fcreate.itemcount.value > 50) { alert("太夸张了吧,小一点呀,不用这么玩命吧!(50以下,含50)") fcreate.itemcount.focus(); return; } if (fcreate.itemcount.value < 1) { alert("太夸张了吧,一个不要你要做什么!(1以上,含1)") fcreate.itemcount.focus(); return; } itemtext = "<table width='700' border='0' align='center' cellpadding='1' cellspacing='1'>"; for (i = 1; i <= fcreate.itemcount.value; i++) { itemtext += "<tr>"+ "<td class='td2' width='76'>菜单项目"+i+"</td>" + "<td colspan='2' class='td2'>" + " <input type='text' name='item" + i + "' class='back2' style='width:200' value='菜单" + i + "'>" + "</td>" + "<td class='td2' width='173'>菜 单 项 目 内 容 网 页</td>" + "<td colspan='2' class='td2'>" + " <input type='file' name='itemsrc" + i + "' class='back2' style='width:200'>" + "</td>" + "</tr>"; } itemtext+="</table>" document.all.itemmenu.innerHTML = itemtext; } } //检查是否是一个合法的颜色数值 function changebkclr(obj) { hexv = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"); flag = false; if (obj.value.length != 6) { alert("请用正确填写!(六位数)"); obj.focus(); } else { for (i = 0; i < 6; i++) { for (j = 0; j <16; j++) if (obj.value.charAt(i).toLowerCase() == hexv[j]) flag = true; if (!flag) { alert("请用十六进制填写。(0-9,a-f)"); obj.focus(); return; } flag = false; } obj.style.background=obj.value; } } //检查是否是一个合法的数字 function checknum(obj) { if (isNaN(obj.value)) { alert("请
输入
数字!"); obj.focus(); return; } } //检查改变数值的速度合法性 function changespd(obj) { fcreate.mspeed.value = 1; } //检查是否是一个合法的速度 function checkspeed(obj) { if (isNaN(obj.value)) { alert("请
输入
数字!"); obj.focus(); } else { if ((obj.form.bodyheight.value - obj.form.headheight.value)%obj.value != 0) { alert("请确认可以被 “菜单体高度 - 菜单题头高度” 整除"); obj.focus(); } } } //控制总题目的填写 function ctrltitle(obj) { if (obj.value == "有") obj.form.titlename.disabled = false; else obj.form.titlename.disabled = true; } </script> <style type="text/
css
"> <!-- .td1{ font-size: 9pt; background: #66CCFF} .td2{ font-size: 9pt; background: #66aaFF} .back1 { font-size: 9pt; width:100} .back2 { font-size: 9pt; background: #BECFEE} --> </style> </head> <body bgcolor='#FFFFFF' text='#000000'> <div align="center"> <textarea name="textCode" rows="28" style="width:700" class="back2" readonly></textarea> <br> <input type="button" name="btnCreate" value="<- 生成代码 (ALT+M)" class="back2" style="width:150" onclick="createCode()" accessKey="m"> <input type="button" name="btnClear" value="#= 清空代码 (ALT+C)" class="back2" style="width:150" onclick="clearCode()" accessKey="c"> <input type="button" name="btnPrev" value="O- 预览效果 (ALT+P)" class="back2" style="width:150" onclick="prevCode()" accessKey="p"> <input type="button" name="btnSelect" value="@@ 全选代码 (ALT+A)" class="back2" style="width:150" onclick="selectCode()" accessKey="a"> </div> <form name="fcreate" method="post" action=""> <table width="700" border="0" align="center" cellpadding="2" cellspacing="1"> <tr> <td class="td1" width="13%" height="13">菜单项目个数</td> <td class="td1" width="12%" height="13"> <input type="text" name="itemcount" style="width:40" class="back2" onblur="checkItems()" value="2"> </td> <td class="td1" width="13%" height="13">菜单题头高度</td> <td class="td1" width="12%" height="13"> <input type="text" name="headheight" class="back2" value="22" style="width:50" onblur="checknum(this)" onchange="checkspeed(fcreate.mspeed)"> </td> <td class="td1" width="13%" height="13">菜单体高度</td> <td class="td1" width="12%" height="13"> <input type="text" name="bodyheight" class="back2" value="202" style="width:50" onblur="checknum(this)" onchange="checkspeed(fcreate.mspeed)"> </td> <td class="td1" width="13%" height="13">填写移动速度</td> <td class="td1" width="12%" height="13"> <input type="text" name="mspeed" class="back2" value="10" style="width:50" onblur="checkspeed(this)"> </td> </tr> <tr> <td class="td1" colspan="8" height="55"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" dwcopytype="CopyTableRow"> <tr> <td class="td1" width="20%">一 般 题 头 颜 色</td> <td class="td1" width="16%"> <input type="text" name="headcolorn" class="back1" style="background:#00A4E1" value="00A4E1" onblur="changebkclr(this)" maxlength="6"> </td> <td class="td1" width="16%">亮 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="lbordern" class="back1" style="background:#00BBFF" value="00BBFF" onblur="changebkclr(this)" maxlength="6"> </td> <td class="td1" width="16%">暗 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="dbordern" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)" maxlength="6"> </td> </tr> <tr> <td class="td1" width="20%">当 前 题 头 颜 色</td> <td class="td1" width="16%"> <input type="text" name="headcolora" class="back1" style="background:#20C1FF" value="20C1FF" onblur="changebkclr(this)" maxlength="6"> </td> <td width="16%" class="td1">亮 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="lbordera" class="back1" style="background:#60D3FF" value="60D3FF" onblur="changebkclr(this)" maxlength="6"> </td> <td class="td1" width="16%">暗 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="dbordera" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)" maxlength="6"> </td> </tr> <tr> <td class="td1" width="20%">菜 单 主 体 颜 色</td> <td class="td1" width="16%"> <input type="text" name="bodycolor" class="back1" style="background:#99CCFF" value="99CCFF" onblur="changebkclr(this)" maxlength="6"> </td> <td width="16%" class="td1">亮 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="lborderb" class="back1" style="background:#B0D8FF" value="B0D8FF" onblur="changebkclr(this)" maxlength="6"> </td> <td class="td1" width="16%">暗 边 颜 色</td> <td class="td1" width="16%"> <input type="text" name="dborderb" class="back1" style="background:#0077FF" value="0077FF" onblur="changebkclr(this)"> </td> </tr> </table> </td> </tr> <tr> <td class="td1" width="80">菜单 总题目</td> <td class="td1" width="85"> <select name="title" style="width:40" class="back2" onchange="ctrltitle(this)"> <option value="有">有</option> <option value="无" selected>无</option> </select> </td> <td width="95" class="td1">题目名称</td> <td colspan="5" class="td1"> <input type="text" name="titlename" class="back2" value="填写总题目" disabled> </td> </tr> </table> <div id="itemmenu"> <table width='700' border='0' align='center' cellpadding='1' cellspacing='1'> <tr> <td class='td2' width='76'>菜单项目1</td> <td colspan='2' class='td2'> <input type='text' name='item1' class='back2' style='width:200' value="菜单1"> </td> <td class='td2' width='173'>菜 单 项 目 内 容 网 页</td><td colspan='2' class='td2'> <input type='file' name='itemsrc1' class='back2' style='width:200'> </td> </tr> <tr> <td class='td2' width='76'>菜单项目2</td> <td colspan='2' class='td2'> <input type='text' name='item2' class='back2' style='width:200' value="菜单2"> </td> <td class='td2' width='173'>菜 单 项 目 内 容 网 页</td><td colspan='2' class='td2'> <input type='file' name='itemsrc2' class='back2' style='width:200'> </td> </tr> </table> </div> </form> <div style="display:none"> <textarea name="text1" rows="5" style="width:700" class="back1" readonly> <html> <head> <title>QQ菜单</title> <meta http-equiv='Content-Type' content='text/html; charset=gb2312'> <script language='JavaScript'> </textarea> <textarea name="text2" rows="5" style="width:700" class="back1" readonly> var moving = false; function showme(obj1, obj2) { if (moving) return; moving = true; for(i=0;i<document.all.tags('td').length;i++) if (document.all.tags('td')[i].className.indexOf('headtd') == 0) document.all.tags('td')[i].className = 'headtd1'; obj2.className = 'headtd2'; moveme(obj1); } function moveme(obj) { idnumber = parseInt(obj.id.substr(4)); objtop = headHeight * (idnumber - 1); objbuttom = bodyHeight + headHeight * (idnumber - 2); currenttop = parseInt(obj.style.top); if (currenttop >= objbuttom) { countid = 1; for(i=0;i<document.all.tags('div').length;i++) if (document.all.tags('div')[i].id == 'item'+countid+'body') { obj = document.all.tags('div')[i]; objtop = headHeight * (countid - 1); if (countid == idnumber) { moveup(obj,objtop,false); break; } else moveup(obj,objtop,true); countid++; } } else if ((currenttop <= objtop) && (idnumber < objcount)) { idnumber++; countid = objcount; for(i=document.all.tags('div').length-1;i>=0;i--) if (document.all.tags('div')[i].id == 'item'+countid+'body') { obj = document.all.tags('div')[i]; objbuttom = bodyHeight + headHeight * (countid - 2); if (countid == idnumber) { movedown(obj,objbuttom,false); break; } else movedown(obj,objbuttom,true); countid--; } } } function moveup(obj,objtop,ismove) { currenttop = parseInt(obj.style.top); if (currenttop > objtop) { obj.style.top = currenttop - step; setTimeout('moveup('+obj.id+','+objtop+','+ismove+')',1) return; } moving = ismove; } function movedown(obj,objbuttom,ismove) { currenttop = parseInt(obj.style.top); if (currenttop < objbuttom) { obj.style.top = currenttop + step; setTimeout('movedown('+obj.id+','+objbuttom+','+ismove+')',1) return; } moving = ismove; } </script> </script> <style type='text/
css
'> </textarea> <textarea name="text3" rows="5" style="width:700" class="back1" readonly> </style> </head> <body bgcolor='#FFFFFF' text='#000000'> </textarea> </div> </body> </html>
提示:您可以先修改部分代码再运行
IE滚动条颜色代码生成器
<SCRIPT language=JavaScript> <!-- Begin function change_colors() { text_area.style.scrollbarBaseColor=document.c_form.BaseColor.value text_area.style.scrollbarArrowColor=document.c_form.ArrowColor.value text_area.style.scrollbarDarkShadowColor=document.c_form.DarkShadowColor.value text_area.style.scrollbarFaceColor=document.c_form.FaceColor.value text_area.style.scrollbarHighlightColor=document.c_form.HighlightColor.value text_area.style.scrollbarShadowColor=document.c_form.ShadowColor.value text_area.style.scrollbar3DLightColor=document.c_form.dlightColor.value if (document.c_form.show_text.value == "Yes") { new_window = open("","displayWindow","width=500,height=400,left=10,top=10"); // open new document new_window.document.open(); // Text of the new document // Replace your " with ' or \" or your document.write statements will fail new_window.document.write("<html><title>JavaScript ScrollBar Code</title>"); new_window.document.write("<body bgcolor=\"#FFFFFF\">"); new_window.document.write("<br>"); new_window.document.write("<html><br>"); new_window.document.write("<body><br>"); new_window.document.write("<script language=\"JavaScript\"><br>"); new_window.document.write("<!--<br>"); if (c_form.BaseColor.value != "") { new_window.document.write("document.body.style.scrollbarBaseColor='"+document.c_form.BaseColor.value +"'"); new_window.document.write("<br>"); } if (c_form.ArrowColor.value != "") { new_window.document.write("document.body.style.scrollbarArrowColor='"+document.c_form.ArrowColor.value +"'"); new_window.document.write("<br>"); } if (c_form.DarkShadowColor.value != "") { new_window.document.write("document.body.style.scrollbarDarkShadowColor='"+document.c_form.DarkShadowColor.value +"'"); new_window.document.write("<br>"); } if (c_form.FaceColor.value != "") { new_window.document.write("document.body.style.scrollbarFaceColor='"+document.c_form.FaceColor.value +"'"); new_window.document.write("<br>"); } if (c_form.HighlightColor.value != "") { new_window.document.write("document.body.style.scrollbarHighlightColor='"+document.c_form.HighlightColor.value +"'"); new_window.document.write("<br>"); } if (c_form.ShadowColor.value != "") { new_window.document.write("document.body.style.scrollbarShadowColor='"+document.c_form.ShadowColor.value +"'"); new_window.document.write("<br>"); } if (c_form.dlightColor.value != "") { new_window.document.write("document.body.style.scrollbar3dlightColor='"+document.c_form.dlightColor.value +"'"); new_window.document.write("<br>"); } new_window.document.write("<br>--><br>"); new_window.document.write("</script><br>"); new_window.document.write("</body><br>"); new_window.document.write("</html><br>"); new_window.document.write("</body></html>"); // close the document new_window.document.close(); } } // End --> </SCRIPT> <CENTER><TEXTAREA name=text_area rows=5 cols=45></TEXTAREA> </CENTER> <DIV align=center> <CENTER> <TABLE width=450> <TBODY> <TR> <TD vAlign=top noWrap align=middle width=112> <FORM name=c_form> <DIV align=center>基础色<BR><SELECT name=BaseColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </DIV></TD> <TD vAlign=top noWrap align=middle width=112>箭头色 <BR><SELECT name=ArrowColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD> <TD vAlign=top noWrap align=middle width=112>暗阴影 <BR><SELECT name=DarkShadowColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD> <TD vAlign=top noWrap align=middle width=112>面色 <BR><SELECT name=FaceColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD></TR> <TR> <TD vAlign=top noWrap align=middle width=112>加亮 <BR><SELECT name=HighlightColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD> <TD vAlign=top noWrap align=middle width=112>阴影 <BR><SELECT name=ShadowColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD> <TD vAlign=top noWrap align=middle width=112>3D亮光 <BR><SELECT name=dlightColor> <OPTION value="" selected>None</OPTION> <OPTION value=#000000>Black</OPTION> <OPTION value=#FFFFFF>White</OPTION> <OPTION value=#008000>Green</OPTION> <OPTION value=#800000>Maroon</OPTION> <OPTION value=#808000>Olive</OPTION> <OPTION value=#000080>Navy</OPTION> <OPTION value=#800080>Purple</OPTION> <OPTION value=#808080>Grey</OPTION> <OPTION value=#FFFF00>Yellow</OPTION> <OPTION value=#00FF00>Lime</OPTION> <OPTION value=#00FFFF>Aqua</OPTION> <OPTION value=#FF00FF>Fushia</OPTION> <OPTION value=#C0C0C0>Silver</OPTION> <OPTION value=#FF0000>Red</OPTION> <OPTION value=#0000FF>Blue</OPTION> <OPTION value=#008080>Teal</OPTION></SELECT> </TD> <TD vAlign=top noWrap align=middle width=112>显示代码<BR><SELECT name=show_text> <OPTION value=No selected>No</OPTION> <OPTION value=Yes>Yes</OPTION></SELECT> </TD></TR> <TR> <TD vAlign=top align=middle width=442 colSpan=4><INPUT onclick=JavaScript:change_colors() type=button value="改变颜色/提取源代码"> <DIV></DIV></FORM></TD></TR></TBODY></TABLE>
提示:您可以先修改部分代码再运行
弹出式窗口代码产生器
<table border=0 cellpadding=0 cellspacing=0 width="63%" align="center"> <tbody> <tr> <td width="0"> <table border=0 cellpadding=0 cellspacing=0 width="76%"> <tbody> <tr> <td width="464"> <div align="center"><b><font color=#7b9431 face=Arial size=3> <script language="JavaScript"> <!-- function uncode() { smut="<"; replace
word
s="< "; txt=document.mail.source2.value; tstx=""; space=replace
word
s.indexOf(" "); wrd=replace
word
s.substring(0,space); wrdl=wrd.length replace
word
s=replace
word
s.substring(space+1,replace
word
s.length); while (txt.indexOf(wrd)>-1){ space=txt.indexOf(wrd); txt=txt.substring(0,space)+smut+txt.substring((space+wrdl),txt.length);} smut=">"; replace
word
s="> "; space=replace
word
s.indexOf(" "); wrd=replace
word
s.substring(0,space); wrdl=wrd.length replace
word
s=replace
word
s.substring(space+1,replace
word
s.length); while (txt.indexOf(wrd)>-1){ space=txt.indexOf(wrd); txt=txt.substring(0,space)+smut+txt.substring((space+wrdl),txt.length);} document.mail.source2.value=txt; } function generate(form){ page = document.inputForm.page.value; toolbars = document.inputForm.toolbars.checked; scrollprops = document.inputForm.scrollit.checked; locations = document.inputForm.locations.checked; statusbars = document.inputForm.statusbars.checked; menubars = document.inputForm.menubars.checked; resizeable = document.inputForm.resizeable.checked; width = document.inputForm.width.value; if (!width) width = screen.width; height = document.inputForm.height.value; if (!height) height = screen.height; howto = document.inputForm.howtoopen.options[document.inputForm.howtoopen.selectedIndex].value; center = document.inputForm.center.checked; start = "<"; if(howto == 'body') { otherOutput = start + "!-- 步骤二: 将Onload事件处理器粘贴在<body>标签内-->\n" + start + "BODY onLoad=\"javascript:popUp()\">"; } if(howto == 'link') { otherOutput = start + "!-- 步骤二: 用以下的链接打开一个新窗口 -->\n" + start + "A HREF=\"javascript:popUp()\">Open the Popup Window" + start + "/A>"; } if(howto == 'button') { otherOutput = start + "!-- 步骤二: 用以下的按钮代码打开一个新窗口-->\n" + start + "form>\n" + start + "input type=button value=\"Open the Popup Window\" onClick=\"javascript:popUp()\">\n" + start + "/form>"; } scriptOutput = start + '!-- 请照以下步骤进行:\r\n\r\n' + '<!-- STEP ONE: 将以下代码粘贴在<head>区 -->\r\n\r\n' + '<HEAD>\r\n\r\n' + start + 'SCRIPT LANGUAGE="JavaScript">\r\n' + 'function pop' + 'Up() {\n'; scriptOutput += "props=window.open('" + page + "', 'poppage', '" + ((toolbars) ? "toolbars=1, " : "toolbars=0, ") + ((scrollprops) ? "scrollbars=1, " : "scrollbars=0, ") + ((locations) ? "location=1, " : "location=0, ") + ((statusbars) ? "statusbars=1, " : "statusbars=0, ") + ((menubars) ? "menubars=1, " : "menubars=0, ") + ((resizeable) ? "resizable=1" : "resizable=0") + ((width) ? ", width=" + width : "") + ((height) ? ", height=" + height : "") + ((center) ? ", left = " + ((screen.width - width) / 2) : "") + ((center) ? ", top = " + ((screen.height - height) / 2) : "") + "');\n}\n// End -->\n" + start + "/sc" + "ript>\n"; output = scriptOutput + "\n\n" + otherOutput + '\n\n' + start +'!--代码结束--'+'>'; document.mail.source.value = output; document.mail.source2.value = output; uncode(); } --> </script> <font size="4"><br> </font></font></b> <font size=3><b>弹出式窗口代码产生器</b></font> </div> <p> <b><font size="2"></font></b></p> <form name=inputForm> <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"> <tr><td> <table border=0 width=100% cellpadding="2" cellspacing="0" bgcolor="#bde6fd"> <tr> <td colspan="2"><font size="2" color=red><b>在新窗口里要打开的文件</b></font> <input type=text name=page size=40><br> <font size="2"><font size="1" color=red>(文件的名字或URL地址...) </font></font></td> </tr> <tr bgcolor="#FFFFFF"> <td colspan="2"><font size="2" color=red><b>请选择要显示的<font size="2"><b>窗口</b></font>元素</b></font></td> </tr> <tr bgcolor="#FFFFFF"> <td width="43%"> <input type=checkbox name=toolbars> <b><font face="Arial" size="2">toolbars</font></b></td> <td width="57%"> <input type=checkbox name=statusbars> <font face="Arial" size="2"><b>status bar</b></font></td> </tr><tr bgcolor="#FFFFFF"><td width="43%"> <input type=checkbox name=scrollit> <b><font face="Arial" size="2">scrollbars</font> </b></td> <td width="57%"> <input type=checkbox name=menubars> <b><font face="Arial" size="2">menu bar</font></b></td> </tr> <tr bgcolor="#FFFFFF"> <td width="43%"> <input type=checkbox name=locations> <b><font face="Arial" size="2">location bar</font> </b></td> <td width="57%"> <input type=checkbox name=resizeable> <b><font face="Arial" size="2">resizeable</font> </b></td> </tr> <tr> <td colspan="2"><font size="2" color=red><b>输入窗口的大小(缺省是满屏打开)</b></font></td> </tr> <tr> <td width="43%"><font face="Arial" size="2"><b> Witdh <input type=text name=width size=4> </b> <font face="Verdana" size="1"> (in pixels)</font></font></td> <td width="57%"> <font face="Arial" size="2"><b>Height</b></font> <input type=text name=height size=4> <font face="Verdana" size="1">(in pixels)</font> </td> </tr> <tr bgcolor="#FFFFFF"> <td colspan="2"><font size="2" color=red><b>窗口打开方式</b></font></td> </tr> <tr bgcolor="#FFFFFF"> <td width="100%" colspan="2"><font face="Arial" size="2"></font> <select name=howtoopen> <option value="button" selected>点按钮</option> <option value="link">点超链</option> <option value="body">自动</option> </select> </td> </tr> <tr> <td width="100%" colspan="2"><font face="Arial" size="2"></font> <input type=checkbox name=center> <font size="2" color=red><b>让窗口出现在屏幕正中间?</b></font></td> </tr> <tr> <td colspan=2> <center> <input type=button value="产生代码!" onClick="javascript:generate();" name="button"> </center> </td> </tr> </table> </td> </tr> </table> </form> <form name="mail" action="" method="POST" onSubmit="return checkCodeMail()"> <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="#000000"> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#BBB7F4"> <tr align="center"> <td> <font size="2" color=#FFFFCC><b>把下面代码Copy到程序中:</b></font><br> <input type=hidden name=scriptname value="Popup Window Maker"> <textarea name="source" rows=6 cols=50 class=9pt></textarea> <br> <input type=hidden name="source2"> <br> </td> </tr> </table> </td> </tr> </table> <br> <center> </center> </form> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>
提示:您可以先修改部分代码再运行
代码转换器(支持JS、VBS与
ASP
)
<HTML><HEAD><TITLE>代码转换器</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <STYLE type=text/css> BODY {MARGIN-TOP: 24px; BACKGROUND-COLOR: white} H1 {FONT: 20px '黑体'; COLOR: black; TEXT-ALIGN: center} TD {FONT: 12px 'Courier New'; COLOR: black} TEXTAREA {FONT: 12px 'Courier New'; COLOR: black} INPUT {FONT: 12px 'Courier New'; COLOR: black} SELECT {FONT: 12px 'Courier New'; COLOR: black} </STYLE> <SCRIPT language=JavaScript> function paste() { //粘帖 var clipboard = window.clipboardData.getData('text'); clipboard == null ? alert('您的剪切板中没有任何文本内容') : source.value = clipboard; } function make() { //转换 if (source.value == '') { alert('文本框中没有代码'); return; } switch (type.value) { case 'ASP': var hStr = 'Response.Write(_\n'; var sStr = '"'; var eStr = '" & _'; var tStr = '"")'; var reExp = /\"/g;; var reTxt = '""'; break; case 'VBScript': var hStr = 'document.write _\n'; var sStr = '"'; var eStr = '" & _'; var tStr = '""'; var reExp = /\"/g; var reTxt = '""'; break; default: var hStr = 'document.write(\n'; var sStr = '\''; var eStr = '\' +'; var tStr = '\'\');'; var reExp = /((\')|(\\))/g; var reTxt = '\\$1'; } var code = source.value.replace(/(^\s*)|(\s*$)/g, '').split("\r\n"); result.value = hStr; for (var i=0; i<code.length; i++) result.value += '\t' + sStr + code[i].replace(reExp, reTxt) + eStr + '\n'; result.value += tStr } function preview() { //预览 if (type.value == 'JavaScript' || type.value == 'VBScript') { var win = window.open(); win.document.open('text/html', 'replace'); win.document.writeln('<script language="' + type.value + '">\n' + result.value + '\n<\/script>'); win.document.close(); } else { alert('无法直接预览'); } } function copy() { //复制 result.value == '' ? alert('没有需要复制的代码') : window.clipboardData.setData('text', result.value); } </SCRIPT> <META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD> <BODY> <TABLE width=750 align=center> <TBODY> <TR> <TD> <H1>代码转换器</H1> <HR> <INPUT onclick=paste(); type=button value=1.粘帖>(将需要进行转换的代码粘帖到下面的文本框中) <TEXTAREA id=source style="WIDTH: 750px; HEIGHT: 180px"></TEXTAREA><BR><BR> <HR> <INPUT onclick=make(); type=button value=2.转换> <SELECT id=type onchange=make();><OPTION value=JavaScript selected>JavaScript</OPTION><OPTION value=VBScript>VBScript</OPTION><OPTION value=ASP>ASP</OPTION></SELECT>(点击转换按钮将完成从HTML代码到相应代码的转换) <TEXTAREA id=result style="WIDTH: 750px; HEIGHT: 180px"></TEXTAREA><BR><BR> <HR> <INPUT onclick=preview(); type=button value=3.预览>(查看转换后的效果) <IMG height=1 width=100> <INPUT onclick=copy(); type=button value=4.复制>(复制转换后的代码到剪贴板中) <BR></TD></TR></TBODY></TABLE></BODY></HTML>
提示:您可以先修改部分代码再运行
UID
27
帖子
861
精华
17
积分
3719
阅读权限
200
在线时间
233 小时
注册时间
2007-5-29
最后登录
2008-10-14
查看详细资料
TOP
junstudio
管理员
个人空间
发短消息
加为好友
当前离线
2
#
大
中
小
发表于 2007-6-18 14:23
只看该作者
将HTML自动转为JS代码
Author:色眯眯的小疯狗
有时候要用Javascript输常用的字符,比如每个页面都要有的脚注。这里提供一个转换脚本:
http://www.blueidea.com/tech/web/2003/1501.asp
<script> function toScript(val) { var value = val.value value = value.replace(/\\/gi,"\\\\").replace(/"/gi,"\\\"").replace(/'/gi,"\\\'") valArr = value.split("\r\n") value="" for (i=0; i<valArr.length; i++) { value += (i==0) ? "info =" : "" value += " \"" + valArr[i] value += (i!=valArr.length-1) ? "\" +\"\\n\"+\n" : "\"\n" } value+="\ndocument.write(info)" val.value = value } </script> <input type=button value="将 HTML 转为 JavaScript" onclick=toScript(document.all["code"])><br> <textarea id=code cols=75 rows=20> <table width="300"> <tr><td align="right">A</td></tr> </table></textarea>
提示:您可以先修改部分代码再运行
将 html 转成 ubb代码的小脚本
Author:windy2000
呵呵,这几天沉溺于灌水,发现转贴的时候真的是很不方便,文字、图形、颜色、连接,如果都转过来真的是满费劲的,于是就写了一个小东西,简陋的很,不过倒是可以省一些事
只写了几个常用的标签,如果要添加其他标签,按照已有的正则照猫画虎
(存储于剪切板的超文本和源文件有可能是不同的!!也就是说浏览器已经对原有 html 进行了规范化)
<script Language="JavaScript1.2"> //coded by windy_sk <[email]windy_sk@126.com[/email]> 20031218 function html_trans(str) { str = str.replace(/\r/g,""); str = str.replace(/on(load|click|dbclick|mouseover|mousedown|mouseup)="[^"]+"/ig,""); str = str.replace(/<script[^>]*?>([\w\W]*?)<\/script>/ig,""); str = str.replace(/<a[^>]+href="([^"]+)"[^>]*>(.*?)<\/a>/ig,"\n[url=$1]$2[/url]\n"); str = str.replace(/<font[^>]+color=([^ >]+)[^>]*>(.*?)<\/font>/ig,"\n[color=$1]$2[/color]\n"); str = str.replace(/<img[^>]+src="([^"]+)"[^>]*>/ig,"\n[img]$1[/img]\n"); str = str.replace(/<([\/]?)b>/ig,"[$1b]"); str = str.replace(/<([\/]?)strong>/ig,"[$1b]"); str = str.replace(/<([\/]?)u>/ig,"[$1u]"); str = str.replace(/<([\/]?)i>/ig,"[$1i]"); str = str.replace(/ /g," "); str = str.replace(/&/g,"&"); str = str.replace(/"/g,"\""); str = str.replace(/</g,"<"); str = str.replace(/>/g,">"); str = str.replace(/<br>/ig,"\n"); str = str.replace(/<[^>]*?>/g,""); str = str.replace(/\[url=([^\]]+)\]\n(\[img\]\1\[\/img\])\n\[\/url\]/g,"$2"); str = str.replace(/\n+/g,"\n"); return str; } function trans(){ var str = ""; rtf.focus(); rtf.document.body.innerHTML = ""; rtf.document.execCommand("paste"); str = rtf.document.body.innerHTML; if(str.length == 0) { alert("剪切版不存在超文本数据!"); return ""; } return html_trans(str); } </script> <textarea style="width:100%; height:200px" id="text" class="textarea" onbeforepaste="if(document.getElementById('x_paste').checked){window.clipboardData.setData('text',trans());this.focus();}"></textarea><br /> <iframe scrolling="no" id="rtf" src="about:blank" MARGINHEIGHT="0" MARGINWIDTH="0" style="width:0px; height:0px;"></iframe> <input type="button" value="转换剪切版超文本数据" onclick="document.getElementById('text').value += trans()"> <input type="checkbox" id="x_paste"> <label for="x_paste">启用超文本粘贴转换</label> <script> rtf.document.designMode="On"; </script>
提示:您可以先修改部分代码再运行
使用说明
在别的网页中选择HTML内容,比如有链接,或者颜色的拷贝。
点击运行代码按钮
直接点击转换
出来的就是论坛专用的 ubb 代码了。
UID
27
帖子
861
精华
17
积分
3719
阅读权限
200
在线时间
233 小时
注册时间
2007-5-29
最后登录
2008-10-14
查看详细资料
TOP
‹‹ 上一主题
|
下一主题 ››
设计人
插画
网页设计
摄影图片
平面设计
设计师加油
站务区
站务管理
娱乐其他
智力游戏
投资理财
娱乐时尚
IT风向标
社会新闻
灌水专区
娱乐八卦
资源共享区
酷站资源
提交酷站
PS笔刷/样式/滤镜&插件
开源软件
免费资源区
实用软件/手册
代码交流区
WEB2.0 / AJAX
ASP,PHP,JSP...
JS,UI框架开发
JQuery
mootools
ProtoType
DHTML eXtensions
CSS代码交流
控制面板首页
编辑个人资料
积分记录
公众用户组
个人空间管理
基本概况
版块排行
主题排行
发帖排行
积分排行
交易排行
在线时间
管理团队
393张高清晰web2.0站点截图
425款精品毛笔墨迹+38款墨迹底纹..
10位Master级别的Photoshop高手
绝对漂亮的笔刷
Soul 近期新作品欣赏..
熟女养成日志—长草
魔幻抽象/吸血鬼传说!!
photoshop仿CG滤镜
新手必看:积分、资源币、人民币、用户级别、发贴教程
设计QQ群:31195683
新手必看:积分、资源币、人民币、用户级别、发贴教程
设计QQ群:31195683