[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Javascript questions



This fails because the Javascript must exist in the current HTML document. The validate function does not exist in the form window, so it fails.

You can get around this by saving the original window like this:

newWindow = window.open("","newWindow",...);
newWindow.creator=window; // creator is an undocumented property

Then in your new window HTML created with the write method, you can refer to the 'window.creator.validate()' function. This seems a bit strange, but it works. You can also refer to variables or frames this way.

----------
From: 	nuwan@telecheck.com[SMTP:nuwan@telecheck.com]
Sent: 	Thursday, February 08, 1996 2:51 PM
To: 	javascript@obscure.org
Cc: 	nuwan@telecheck.com
Subject: 	Javascript questions 

I am trying to allow the user to enter data using another window. I open this
new window in a function in my main html file. Then I use write method to 
create a form inside that new window plus a 'OK' button. On the onClick
event of ok button I want to call a validate function that is defined in that 
file. When I load the html file I get a form in a seperate window but when I 
click on the ok button I get a javascript error saying validate function is
not defined. May be that the validate function is not visible in the new
window. Does anybody in this list know any solutions for this ? 
Thanks
- Nuwan