Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: NetScape equivalent to innerText


Message #1 by "Bill Gunnell" <bgunnell@t...> on Wed, 10 Jan 2001 23:49:44 -0000
Their is no NS or other browser equiverlent for innerText as it is an 
IE only tag, you may be able to use DHTML or split your pages is into 
several frames that submit back to some server side code to rebuild the 
page correctly.

> -----Original Message-----
> From: bgunnell@t... [mailto:bgunnell@t...]
> Sent: 10 January 2001 23:50
> To: javascript@p...
> Subject: [javascript] NetScape equivalent to innerText
> 
> 
> Hi,
> 
> I've got a data entry form on a web page which requires the 
> user to enter
> various codes.  Some users won't be familiar with the codes 
> so I pop-up
> another page with a list of the codes/descriptions in a 
> table.  When the
> user clicks on the description, the code & description are 
> writen back to
> the form.  The 'code' ends up in the appropriate input field while the
> description ends up next to it (in a table cell with an id tag). 
> [Remember this is being executed in the pop-up window so 
> document.opener
> is needed to reference the parent window].
> 
> In IE this is working fine....  with NetScape the 'code' is OK but the
> description doesn't make it...  Of course, Netscapes document 
> model isn't
> the same as IE so that's where the problem is....  Here's the 
> code I've
> got so far (ignore the cfoutputs - this is being generated in cold
> fusion):
> 
> // copy the code over to the form field
> window.opener.document.<cfoutput>#attributes.field#</cfoutput>
> .value = selection;
> 
> // copy the description to the next table cell
>         
> if (window.opener.document.all) 
>    // internet explorer
>           
> window.opener.document.<cfoutput>#attributes.desc#</cfoutput>.
> innerText 
> description;
> else if (window.opener.document.layers) 
>    {
>    // Netscape Navigator  - this bit doesn't work!
>    window.opener.document.layers['DistTypeDesc'].document.open();
>   
> window.opener.document.layers['DistTypeDesc'].document.write('
> Testing');
>    window.opener.document.layers['DistTypeDesc'].document.close();
>   
> window.opener.document.layers.'DistTypeDesc'].document.visibil
> ity='visible';
> 
>    } 
> 
> Here's a snippet from the page where the data is being sent...
> 
> 								
> 	<td>
> 								
> 		<input type="text" name="DistTypeCode" 
> value="<cfoutput>#HTMLEditFormat(attributes.DistTypeCode)#</cf
> output>" size="20"
> maxlength="4" />
>         </td>
> 	<td>
> 	<a 
> href="<cfoutput>#request.home#</cfoutput>ref/index.cfm?fuseact
> ion=PopUpRefCodes&Command=LIST&TableID=5&field=Fil
terForm.DistTypeCode&Title=District+Type&Desc=all.DistTypeDesc"
> target='popup' onclick="result 
> window.open('','popup','height=450,width=300,scrollbars=no');
> result.focus(); "><img 
> src="<cfoutput>#request.image#</cfoutput>magnif4.gif" 
> width="21" height="21"
> border="0" alt="Select list to filter on." /></a>
> 	</td>
> 	<td id="DistTypeDesc" 
> class="iwuddesc"><cfoutput>#DistTypeDesc#</cfoutput> </td>
> 
> 
> 
> Suggestions welcome! Thanks!

  Return to Index