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

Re: Javascript questions



nuwan@telecheck.com wrote:
> 
> 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

The function you call, must be defined in the same document as the form. When you open a 
new window, you create a new document with no functions defined.

1. One solution is to open the new window, create the function using the write command 
and then write the form.

2. An easier way could be to open a new window and then open an HTML document (with the 
function,the form and everything else included), by using window.[frame].location="href".


Lasse Munk-Poulsen
-----------------------------
DENMARK, WebMedia@vip.cybercity.dk