Hi,everybody! I have resolved my problem based on http://www.gt-templates.com/archive/index.php/t-9428.html. Below is the solution: change > window.parent.frames['mainFrame'].window.attachEvent("onload",openModal); into window.parent.document.getElementsByTagName('frame')['mainFrame'].attachEven t('onload',openModal);
who can tell me the difference between two ways above? Thanks in advance! James ----- Original Message ----- From: "JamesWang" <[EMAIL PROTECTED]> To: <selenium-devel@lists.public.thoughtworks.org> Sent: Friday, November 18, 2005 9$22 AM Subject: [Selenium-devel] question about event of frame > Hi,everybody! > I am modifying selenium to test frames and made some progress.But now I > have some questions about event handler of frames: > > ---------------------------------- > topFrame > ---------------------------------- > mainFrame > ---------------------------------- > bottomFrame > ---------------------------------- > > The example of above worked.But below didn't work. > > ---------------------------------- > topFrame > <script> > function overrideOnLoad() { > > window.parent.frames['mainFrame'].window.attachEvent("onload",openModal); > > window.parent.frames['mainFrame'].document.all["username"].attachEvent("oncl > ick",openModal); > } > </script> > > <body> > <button id="override" > onclick="javascript:overrideOnLoad()">override</button> > </body> > > ---------------------------------- > mainFrame > > <input name='username'/> > ---------------------------------- > bottomFrame > ---------------------------------- > > The second line of overrideOnLoad worked but the first line didn't.Why? > Thanks in advance. > > James > > _______________________________________________ > Selenium-devel mailing list > Selenium-devel@lists.public.thoughtworks.org > http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel _______________________________________________ Selenium-devel mailing list Selenium-devel@lists.public.thoughtworks.org http://lists.public.thoughtworks.org/mailman/listinfo/selenium-devel