Programming > JavaScript

How to Pass HTML to POP UP window?

(1/2) > >>

onetwothree:
Hi,

I am opening help messages in popup window. If a customer is login than I want to show 'Welcome Customer_name' on the top of the pop up. How can I send this data to POP UP window from parent window?

David:

--- Code: ---function popUp(){

var mywin = window.open("","wildebeast","width=350,height=350,scrollbars=1,resizable=1")

var text = document.form.input.value

var html = "<html><head></head><bodyWelcome, <b>"+ Customer +"</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

mywin.document.open()
mywin.document.write(html)
mywin.document.close()

}
--- End code ---

Try this code. Not tested.

Bramwell:
hey....I have no knowledge about computer programing language like html, dhtml, java script etc. So I can't any comment on this post. I'm really very sorry.

disneycham:
you can the pop up.html in the code below for additional pages and copy the "pop-up.htm" and give it the name you edited the link with. Make sure the names match exactly, hosting is case sensitive.

vipandiversity:
The variables newwindow, def1 and def2 are local variables, that means they are declared inside a function. You can't get those variables from another function or window that way.

What you should do it put newwindow, def1 and def2 outside of the function:
Code:

var newwindow;
var def1 = 'hi';
var def2 = 'there';

function popwindow(url, name) {
newwindow = window.open(url, name, 'height=500,width=800');
if (window.focus) { newwindow.focus(); }
}

Navigation

[0] Message Index

[#] Next page

Go to full version