Safari cannot created variable dynamically?

N

nick

I have the following code to open a popup window and pass a value.

In the main html page:

var w = window.open("popup.htm","","width=510,height=450");
w.itemIndex = 100; // alert(w.itemIndex) will show 100

The popup window will be openned. However,
in the popup.htm, javascript code

alert(this.itemIndex) shows 'undefined', while it shows right value (100 in
this example) in Firefox, IE.

How to pass value when using Safari?

Thanks.
 
M

Martin Honnen

nick said:
I have the following code to open a popup window and pass a value.

In the main html page:

var w = window.open("popup.htm","","width=510,height=450");
w.itemIndex = 100; // alert(w.itemIndex) will show 100

The popup window will be openned. However,
in the popup.htm, javascript code

alert(this.itemIndex) shows 'undefined', while it shows right value (100 in
this example) in Firefox, IE.

What does Safari show for
window.itemIndex
?
 
J

Joakim Braun

nick said:
I have the following code to open a popup window and pass a value.

In the main html page:

var w = window.open("popup.htm","","width=510,height=450");
w.itemIndex = 100; // alert(w.itemIndex) will show 100

The popup window will be openned. However,
in the popup.htm, javascript code

alert(this.itemIndex) shows 'undefined', while it shows right value (100 in
this example) in Firefox, IE.

How to pass value when using Safari?

Thanks.

Perhaps popup.htm renders its content before w.itemIndex is defined?
 
N

nick

Not likely, I added alert(itemIndex) in the function called by onload and it
still shows undefined on Safari.
w.itemIndex should create a public member itemIndex of the object window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top