JS pop-up window code generator _javascript Tips

Source: Internet
Author: User
<div ><p> pop-up window code builder </p></div> to complete this effect, add the following code to the <body> area <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> &LT;TD width= "464" > <div align= "center" ><b><font color= #7b9431 face=arial size=3> <script language= "JavaScript" > <!--function Uncode () {smut= "<"; Replacewords= "<"; Txt=document.mail.source2.value; Tstx= ""; Space=replacewords.indexof (""); Wrd=replacewords.substring (0,space); Wrdl=wrd.length replacewords=replacewords.substring (space+1,replacewords.length); while (Txt.indexof (WRD) >-1) {space=txt.indexof (WRD); Txt=txt.substring (0,space) +smut+txt.substring ((SPACE+WRDL), txt.length); Smut= ">"; Replacewords= ">"; Space=replacewords. IndexOf (""); Wrd=replacewords.substring (0,space); Wrdl=wrd.length replacewords=replacewords.substring (space+1,replacewords.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 = "<"; IfHowto = = ' body ') {otheroutput = start + "!--Step two: Paste the OnLoad event handler in the <body> tag-->\n" + Start + "Body onload=\" Javas Cript:popup () ">"; } if (howto = = ' link ') {otheroutput = start + "!--Step two: Open a new window with the following link-->\n" + Start + "A href=\" javascript:popup () \ " >open the Popup window "+ start +/a>"; } if (howto = = ' button ') {otheroutput = start + "!--Step two: Open a new window with the following button code-->\n" + Start + "form>\n" + Start + "InP UT type=button value=\ "" Open the Popup window\ "onclick=\" javascript:popup () \ ">\n" + start + "/form>"; Scriptoutput = start + '!--follow these steps: \r\n\r\n ' + ' <!--Step one: Paste the following code in the <pead> area-->\r\n\r\n ' + ' <pead >\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" + otheroutput + ' \ n ' + start + '!--code end-' + ' > '; Document.mail.source.value = output; Document.mail.source2.value = output; Uncode (); }--> </script> <font size= "4" > </font></font></b> <font size=3><b> pop-up window Port code generator </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" &G T <tr><td> <table border=0 width=100% cellpadding= "2" cellspacing= "0" bgcolor= "#bde6fd" > <tr> <td colspan= "2" ><font size= "2" color=r Ed><b> in a new window file to open </b></font> <input type=text name=page size=40> <font si Ze= "2" ><font size= "1" color=red> (file name or URL address ...) </font></font></td> </tr> < TR bgcolor= "#FFFFFF" > <td colspan= "2" ><font size= "2" color=red><b> Please select <font size= "2" to display ;<b> Windows </b></font> elements </b></font></td> </tr> <tr bgcolor= "#FFFFFF" > &LT;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&gt ; <font face= "Arial" size= "2" ><b>status bar</b></font></td> </tr><tr " #FFFFFF ">&ltTD 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><fo NT 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</f ont> </b></td> <td width= "57%" > <input type=c Heckbox name=resizeable> <b><font face= "Arial" size= "2" >resizeable</font> </b></td> </tr> <tr> <td colspan= "2" ><fon T size= "2" color=red><b> the size of the input window (the default is Full screen open) </b></font></td> </tr> <tr> <td width= "43%" ><font face= "Arial" size= "2" ><b> WITDH <input type=text name=width size=4> </b> <fon T face= "Verdana" size= "1" > (in pixels) </font></font></td> <td width= "57%" > <font face= "Arial" size= "2" ><b>Height</b></font> <input type=t Ext 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> window open mode </b></font></td> </tr> <tr bgcolor= "#FFFFFF" > <td width= "100%" colspan= "2" ><font face= "Arial" Size= "2" ></font> <select name=howtoopen> <opti On value= "button" selected> dot button </option> <option value= "link" > Dot Hyper-Chain &LT;/OPTION&GT ; <option value= "Body" > Auto </option> </select> &LT;/TD&G T </tr> <tr> <td width= "100%" colspan= "2" ><font face= " Arial "size=" 2 "></font> <input type=checkbox name=center> <font size= "2" color=red><b> let the window appear in the middle of the screen? </b></font></td&Gt </tr> <tr> <td colspan=2> & lt;center> <input Type=button value= "Generate code! onclick=" Javascript:generate (); "Name=" butt On "> </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" cell padding= "0" bgcolor= "#BBB7F4" > <tr align= "center" > <td> <font size= "2" color= #FFFFCC ><b> Copy the following code into the program:</b></font> <input t Ype=hidden name=scriptname value= "Popup window Maker" > <textarea name= "source" rows=6 S=50 class=9pt></textarea> <input type=hidden name= "so Urce2 "> </td> </tr> </table> </td> </tr> </table> <center> </center> </form> </td> </tr> </tbody> </table> </td> </tr> </tbody> &L T;/table>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.