Javascript-based pop-up window code generator _ javascript skills

Source: Internet
Author: User
Js pop-up window Code Generator

<P style = "text-align: center; height: 30px; "> pop-up window code generator </p> 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> <td width = "464"> <p align = "center"> <B> <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. inpu TForm. toolbars. checked; scrollprops = document. inputForm. scrol.pdf. 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 + "! -- Step 2: paste the Onload event processor in the <body> tag --> \ n "+ start +" BODY onLoad = \ "javascript: popUp () \"> ";} if (howto = 'link') {otherOutput = start + "! -- Step 2: Use the following link to open A new window --> \ n "+ start +" a href = \ "javascript: popUp () \ "> Open the Popup Window" + start + "/A>";} if (howto = 'button ') {otherOutput = start + "! -- Step 2: use the following button code to Open a new Window --> \ n "+ start +" form> \ n "+ start +" input 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' + '<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" + otherOutput + '\ n \ n' + start + '! -- Code end -- '+'> '; document. mail. source. value = output; document. mail. source2.value = output; uncode ();} --> script </B> <B> pop-up window code generator </B> </p> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.