资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
js之弹出式窗口代码生成器
<div style="text-align:center; height:30px;"><h3>弹出式窗口代码生成器</h3></div> 要完成此效果把如下代码加入到<body>区域中 <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> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20language%3D%22JavaScript%22%3E%20%0D%0A%3C!--%20%20%20%0D%0Afunction%20uncode()%20%7B%20%0D%0Asmut%3D%22%26lt%3B%22%3B%20%0D%0Areplacewords%3D%22%3C%20%22%3B%20%0D%0Atxt%3Ddocument.mail.source2.value%3B%20%0D%0Atstx%3D%22%22%3B%20%0D%0Aspace%3Dreplacewords.indexOf(%22%20%22)%3B%20%0D%0Awrd%3Dreplacewords.substring(0%2Cspace)%3B%20%0D%0Awrdl%3Dwrd.length%20%0D%0Areplacewords%3Dreplacewords.substring(space%2B1%2Creplacewords.length)%3B%20%0D%0Awhile%20(txt.indexOf(wrd)%3E-1)%7B%20%0D%0Aspace%3Dtxt.indexOf(wrd)%3B%20%0D%0Atxt%3Dtxt.substring(0%2Cspace)%2Bsmut%2Btxt.substring((space%2Bwrdl)%2Ctxt.length)%3B%7D%20%0D%0Asmut%3D%22%26gt%3B%22%3B%20%0D%0Areplacewords%3D%22%3E%20%22%3B%20%0D%0Aspace%3Dreplacewords.indexOf(%22%20%22)%3B%20%0D%0Awrd%3Dreplacewords.substring(0%2Cspace)%3B%20%0D%0Awrdl%3Dwrd.length%20%0D%0Areplacewords%3Dreplacewords.substring(space%2B1%2Creplacewords.length)%3B%20%0D%0Awhile%20(txt.indexOf(wrd)%3E-1)%7B%20%0D%0Aspace%3Dtxt.indexOf(wrd)%3B%20%0D%0Atxt%3Dtxt.substring(0%2Cspace)%2Bsmut%2Btxt.substring((space%2Bwrdl)%2Ctxt.length)%3B%7D%20%0D%0Adocument.mail.source2.value%3Dtxt%3B%20%0D%0A%7D%20%0D%0A%0D%0A%0D%0Afunction%20generate(form)%7B%20%0D%0Apage%20%3D%20document.inputForm.page.value%3B%20%0D%0Atoolbars%20%3D%20document.inputForm.toolbars.checked%3B%20%0D%0Ascrollprops%20%3D%20document.inputForm.scrollit.checked%3B%20%0D%0Alocations%20%3D%20document.inputForm.locations.checked%3B%20%0D%0Astatusbars%20%3D%20document.inputForm.statusbars.checked%3B%20%0D%0Amenubars%20%3D%20document.inputForm.menubars.checked%3B%20%0D%0Aresizeable%20%3D%20document.inputForm.resizeable.checked%3B%20%0D%0Awidth%20%3D%20document.inputForm.width.value%3B%20%0D%0Aif%20(!width)%20width%20%3D%20screen.width%3B%20%0D%0Aheight%20%3D%20document.inputForm.height.value%3B%20%0D%0Aif%20(!height)%20height%20%3D%20screen.height%3B%20%0D%0Ahowto%20%3D%20document.inputForm.howtoopen.options%5Bdocument.inputForm.howtoopen.selectedIndex%5D.value%3B%20%0D%0Acenter%20%3D%20document.inputForm.center.checked%3B%20%0D%0Astart%20%3D%20%22%3C%22%3B%20%0D%0Aif(howto%20%3D%3D%20'body')%20%7B%20%0D%0AotherOutput%20%3D%20start%20%2B%20%22!--%20%E6%AD%A5%E9%AA%A4%E4%BA%8C%3A%20%E5%B0%86Onload%E4%BA%8B%E4%BB%B6%E5%A4%84%E7%90%86%E5%99%A8%E7%B2%98%E8%B4%B4%E5%9C%A8%3Cbody%3E%E6%A0%87%E7%AD%BE%E5%86%85--%3E%5Cn%22%20%2B%20start%20%2B%20%22BODY%20onLoad%3D%5C%22javascript%3ApopUp()%5C%22%3E%22%3B%20%0D%0A%7D%20%0D%0Aif(howto%20%3D%3D%20'link')%20%7B%20%0D%0AotherOutput%20%3D%20start%20%2B%20%22!--%20%E6%AD%A5%E9%AA%A4%E4%BA%8C%3A%20%E7%94%A8%E4%BB%A5%E4%B8%8B%E7%9A%84%E9%93%BE%E6%8E%A5%E6%89%93%E5%BC%80%E4%B8%80%E4%B8%AA%E6%96%B0%E7%AA%97%E5%8F%A3%20--%3E%5Cn%22%20%2B%20start%20%2B%20%22A%20HREF%3D%5C%22javascript%3ApopUp()%5C%22%3EOpen%20the%20Popup%20Window%22%20%2B%20start%20%2B%20%22%2FA%3E%22%3B%20%0D%0A%7D%20%0D%0Aif(howto%20%3D%3D%20'button')%20%7B%20%0D%0AotherOutput%20%3D%20start%20%2B%20%22!--%20%E6%AD%A5%E9%AA%A4%E4%BA%8C%3A%20%E7%94%A8%E4%BB%A5%E4%B8%8B%E7%9A%84%E6%8C%89%E9%92%AE%E4%BB%A3%E7%A0%81%E6%89%93%E5%BC%80%E4%B8%80%E4%B8%AA%E6%96%B0%E7%AA%97%E5%8F%A3--%3E%5Cn%22%20%2B%20start%20%2B%20%22form%3E%5Cn%22%20%2B%20start%20%2B%20%22input%20type%3Dbutton%20value%3D%5C%22Open%20the%20Popup%20Window%5C%22%20onClick%3D%5C%22javascript%3ApopUp()%5C%22%3E%5Cn%22%20%2B%20start%20%2B%20%22%2Fform%3E%22%3B%20%0D%0A%7D%20%0D%0AscriptOutput%20%3D%20start%20%2B%20'!--%20%E8%AF%B7%E7%85%A7%E4%BB%A5%E4%B8%8B%E6%AD%A5%E9%AA%A4%E8%BF%9B%E8%A1%8C%3A%5Cr%5Cn%5Cr%5Cn'%20%0D%0A%2B%20'%3C!--%20STEP%20ONE%3A%20%E5%B0%86%E4%BB%A5%E4%B8%8B%E4%BB%A3%E7%A0%81%E7%B2%98%E8%B4%B4%E5%9C%A8%3Chead%3E%E5%8C%BA%20--%3E%5Cr%5Cn%5Cr%5Cn'%20%0D%0A%2B%20'%3CHEAD%3E%5Cr%5Cn%5Cr%5Cn'%20%2B%20start%20%2B%20'SCRIPT%20LANGUAGE%3D%22JavaScript%22%3E%5Cr%5Cn'%20%0D%0A%2B%20'function%20pop'%20%2B%20'Up()%20%7B%5Cn'%3B%20%0D%0AscriptOutput%20%2B%3D%20%22props%3Dwindow.open('%22%20%2B%20page%20%2B%20%22'%2C%20'poppage'%2C%20'%22%20%2B%20%0D%0A((toolbars)%20%3F%20%22toolbars%3D1%2C%20%22%20%3A%20%22toolbars%3D0%2C%20%22)%20%2B%20%0D%0A((scrollprops)%20%3F%20%22scrollbars%3D1%2C%20%22%20%3A%20%22scrollbars%3D0%2C%20%22)%20%2B%20%0D%0A((locations)%20%3F%20%22location%3D1%2C%20%22%20%3A%20%22location%3D0%2C%20%22)%20%2B%20%0D%0A((statusbars)%20%3F%20%22statusbars%3D1%2C%20%22%20%3A%20%22statusbars%3D0%2C%20%22)%20%2B%20%0D%0A((menubars)%20%3F%20%22menubars%3D1%2C%20%22%20%3A%20%22menubars%3D0%2C%20%22)%20%2B%20%0D%0A((resizeable)%20%3F%20%22resizable%3D1%22%20%3A%20%22resizable%3D0%22)%20%2B%20%0D%0A((width)%20%3F%20%22%2C%20width%3D%22%20%2B%20width%20%3A%20%22%22)%20%2B%20%0D%0A((height)%20%3F%20%22%2C%20height%3D%22%20%2B%20height%20%3A%20%22%22)%20%2B%20%0D%0A((center)%20%3F%20%22%2C%20left%20%3D%20%22%20%2B%20((screen.width%20-%20width)%20%2F%202)%20%3A%20%22%22)%20%2B%20%0D%0A((center)%20%3F%20%22%2C%20top%20%3D%20%22%20%2B%20((screen.height%20-%20height)%20%2F%202)%20%3A%20%22%22)%20%2B%20%0D%0A%22')%3B%5Cn%7D%5Cn%2F%2F%20End%20--%3E%5Cn%22%20%2B%20start%20%2B%20%22%2Fsc%22%20%2B%20%22ript%3E%5Cn%22%3B%20%0D%0Aoutput%20%3D%20scriptOutput%20%2B%20%22%5Cn%5Cn%22%20%2B%20otherOutput%20%2B%20'%5Cn%5Cn'%20%2B%20start%20%2B'!--%E4%BB%A3%E7%A0%81%E7%BB%93%E6%9D%9F--'%2B'%3E'%3B%20%0D%0Adocument.mail.source.value%20%3D%20output%3B%20%0D%0Adocument.mail.source2.value%20%3D%20output%3B%20%0D%0Auncode()%3B%20%0D%0A%7D%20%0D%0A--%3E%20%0D%0A%3C%2Fscript%3E"> <font size="4"> </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> <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> <input type=hidden name=scriptname value="Popup Window Maker"> <textarea name="source" rows=6 cols=50 class=9pt></textarea> <input type=hidden name="source2"> </td> </tr> </table> </td> </tr> </table> <center> </center> </form> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程