Javascript Help

kannanvenkatesh
07-12-2002, 08:33 AM
I've created a new window named orderwindow, from another window using open method of javascript. I've put a button in a orderwindow.

What i wanted to know is that whether i can generate a event when i click the button on the orderwindow which was created by javascript in another window. If so i have written one function on the parent window named function1(). I want to call that function in the orderwindow button onClick event.

Thinker
07-12-2002, 08:42 AM
When you say 'window' are you talking about frames on the same
instance of the browser, or multiple browser windows?

kannanvenkatesh
07-12-2002, 08:48 AM
Thinker... i mentioned multiple browser windows NOT FRAMES in the same window.

Thinker
07-12-2002, 09:17 AM
Then I don't believe it is possible.

The word browser is nowhere in your question.

kannanvenkatesh
07-12-2002, 09:31 AM
i don't know how you understood me.when i mentioned mulitple browser windows. i meant two windows of the same browser. i.e internet explorer alone not any other browsers like netscape. the second one was generated by the first window javascript code with open() method.

rich2kchan
07-12-2002, 11:39 AM
U can do it by using the opener handle of the parent window, for example look at the following htmls:

Parent Window

<html>
<head>
<title>Parent Window</title>
<script language="javaScript">
function function1(){
alert("HelloWorld.")
// Code here
}
</script>
</head>
<body onload="window.open('orderwindow.html')">

</body>
</html>


New Window (OrderWindow)

<html>
<head>
<title>New Window</title>
</head>
<body>
<input type="button" value="Click Me" onClick="window.opener.function1()">
</body>
</html>

kannanvenkatesh
07-12-2002, 01:53 PM
Thanks rich2kchan :)
your code is just the thing that i wanted.

rich2kchan
07-12-2002, 02:11 PM
actually i think i should thank you for asking me...
i dun even kno that i can do that
haha

PS: np

Thinker
07-12-2002, 02:17 PM
And I learned something new too. Thanks rich2kchan.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum