Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: object value from getElementById


Message #1 by "cecil metcalf" <zippy6140@n...> on Wed, 25 Apr 2001 19:15:06
I have inherited an application using document.all and document.layer. 
Well, I need to make this application compatible with NS6+.  Currently the 
app literally blows up NS+.<sign>

The span id, form name are dynmically created based on how many forms are 
on the page, the number of forms is determined by how many kids a person 
has signed up for health benefits (this app is how employee sign up for 
health insurance).  So, here is the current code:
function blankoutPCP(text)
{ var what
  if (document.all)      {what = eval("document.frm" + text 
+ ".elements") }
  if (document.layers)   {what = eval("document.layers['DepSpan" + text 
+"'].document.frm" + text + ".elements")}
  if (document.getElementById) { what = document.getElementById("DepSpan" 
+ text)}
	 eval("what.pcp" + text + ".value=''")

}
Here is the page source when I do a view source:
<FORM NAME=DepForm06>

<td valign=top><font face="verdana"><input type=radio 
onfocus="displayDivision2(this.value,'DepSpan06','06');" name='rad06' 
CHECKED  value='Y'>Yes</font></td>

<td valign=top><font face="verdana"><input type=radio name='rad06' 
value='N' onfocus="displayDivision2
(this.value,'DepSpan06','06');">No</font>


<input type=hidden name='rel06' value='D '><input type=hidden name=need06 
value=Y></td></form><td valign=TOP><span ID=DepSpan06  class=addons2><form 
name=frm06 onsubmit='return false;'>

<font face="verdana"><input type=text maxlength=8 size=12 value="3456" 
name='pcp06'></font>

</span></form></td>

I need the variable what to have the same value as the text value "3456".  
Help, everthing I have tried keeps telling me that what has not properties.

zippy

  Return to Index