KnowlegeZone.com, Share knowledge Gain knowledge
     

Home > JavaScript : Open a pop-up window without specifying a URL

Article By: saqib   Date: 9/30/2008

Open a pop-up window without specifying a URL

By using code below you can create a Javascript's POP up window content dynamically, you dont have to specify a url.

function popUp(){

var frog = window.open("","wildebeast","width=300,height=300,scrollbars=1,resizable=1")

var text = document.form.input.value

var html = "<html><head></head><body>Hello, <b>"+ text +"</b>."
html += "How are you today?</body></html>"

//variable name of window must be included for all three of the following methods so that
//javascript knows not to write the string to this window, but instead to the new window

frog.document.open()
frog.document.write(html)  // you write here
frog.document.close()

}

 


Share |

Comments.
Comment/Solution Posted By: khan    Date: 10/16/2008 12:43:00 AM
Opening a pop-up window without specifying a URL is helpfull when you want to create code for a dynamic window using some server side technology.

Comment/Solution Posted By: ayesir    Date: 12/9/2008 3:07:00 PM
This function works great for Firefox, but had a problem with IE. Fixed it by making a change to the parms for the window from '1' to 'yes':
var frog = window.open("","wildebeast","width=300,height=300,scrollbars=yes,resizable=yes")

Comment/Solution Posted By: Saqib    Date: 12/9/2008 3:11:00 PM
Thanks ayesir for sharing.


Pages :
Post Comment or Solution   OR   Sign in using Google/Aol/Yahoo/Msn/OpenID
Your Name:  
Your Email:  
Comments:
 
Please Verify:
(Type Answer)