SPAM-LOW: [Javascript] Accessing atributes - window.opener

Guilherme Cordeiro guilhermecordeiro at yahoo.com.br
Mon Sep 27 15:16:28 CDT 2004


Thank you so much, it finally worked.

 --- Peter Brunone <peter at brunone.com> escreveu: 
> Guillermo,
> 
> 	To refer to a form the way you're doing it in your
> Javascript
> below, the form needs a name attribute (the id
> attribute won't show up
> in the document.formName tree).
> 
> Cheers,
> 
> Peter Brunone
> ___________________
> www.EasyListBox.com
> 
> -----Original Message-----
> From: javascript-bounces at LaTech.edu On Behalf Of
> Guilherme Cordeiro
> 
> Here I go again...
> 
> Now, I've put an input text field on the first page.
> With a click in OK, on the opened window, I want to
> put a value on this input text field. I tried
> several
> things, like window.opener.document...,
> self.opener.document, and so on. None of these
> worked.
> 
> Does anyone know what could be wrong? Thanks.
> 
> main.html (calls the pop-up window) :
> 
> <HTML>
> <HEAD>
>   <script src="window.js"></script>
> </HEAD>
> 
> <BODY onfocus="javascript:checkForDialog();"
> id="main"> 
>   <a href="javascript:topwind();">Click</a> to open
> small window.</p>
>   <form id="update">
>     <input type="text" name="code">
>   </form>
> </BODY>
> </HTML>
> 
> 
> button.html (elements of the pop-up window) :
> 
> <HTML>
> <HEAD>
>   <script src="window.js"></script>
> </HEAD>
> 
> <BODY onfocus="javascript:checkForDialog();">
> <FORM id="select">
>   <table cellSpacing="1" cellPadding="2" width="300"
> border="0">
>     <tr>
>       <td colSpan="2">Select option:</td>
>     </tr>
>     <tr>
>       <td></td>
>       <td>&nbsp;</td>
>      </tr>
>     <tr>
>       <td>Letters:&nbsp;</td>
>       <td>
>         <select name="select_l">
>           <option value="Option A">Option A
>           <option value="Option B">Option B
>           <option value="Option C">Option C
>           <option value="Option D">Option D
>         </select>
>       </td>
>     </tr>
>     <tr>
>       <td></td>
>       <td>&nbsp;</td>
>     </tr>
>     <tr>
>       <td colSpan="2">
>         <P align="center">
>           <input type="button" name="but_ok"
> value="OK"
> onclick="javascript:closeWindow();">&nbsp;
>           <input type="button" name="but_cancel"
> value="Cancel" onclick="">
>         </P>
>       </td>
>     </tr>
>   </table>
> </FORM>
> </BODY>
> </HTML>
> 
> 
> window.js (contains javascript functions) :
> 
> var newWindow;
> 
> function topwind()
> {
>   newWindow =
>
window.open('button.html','newWindow','toolbar=no,status=no,width=350,he
> ight=200')
> }
> 
> function checkForDialog()
> {
>   if (newWindow && newWindow != null &&
> !newWindow.closed)
>   {
>     newWindow.focus();
>   }
> }
> 
> function closeWindow()
> {
>   self.opener.document.update.code.value = "50";
> //error here
>   //according to mozilla javascript console, this is
> the error:
>   //  Error: self.opener.document.update has no
> properties
>   //  Source: file:///d:/guilherme/java/window.js
>   //  Line: 18
>   self.close();
>   self.opener.newWindow = null;
> }
> 
> 
> 	
> 	
> 		
>
_______________________________________________________
> Yahoo! Messenger 6.0 - jogos, emoticons sonoros e
> muita diversão.
> Instale agora!
> http://br.download.yahoo.com/messenger/
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>  


	
	
		
_______________________________________________________
Yahoo! Messenger 6.0 - jogos, emoticons sonoros e muita diversão. Instale agora!
http://br.download.yahoo.com/messenger/



More information about the Javascript mailing list