You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2007/04/16 23:10:42 UTC

pls help - > how to use document.getElementsByTagName inside html:text

plain html file
      <input type='text' name='part'>
      i can use javascript to access "input" tag by 
          document.getElementsByTagName("INPUT");
   
  but for struts html file
      <html:text property="part">
     i can not use javascript to access "input" tag by
       either  
          document.getElementsByTagName("INPUT");
       or 
          document.getElementsByTagName("HTML:TEXT");
   
  Can anyone give me ur hand?
   
  tks in advance
   
  john
   

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: pls help - > how to use document.getElementsByTagName inside html:text

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John,

john lee wrote:
> plain html file
>       <input type='text' name='part'>
>       i can use javascript to access "input" tag by 
>           document.getElementsByTagName("INPUT");
>    
>   but for struts html file
>       <html:text property="part">
>      i can not use javascript to access "input" tag by
>        either  
>           document.getElementsByTagName("INPUT");
>        or 
>           document.getElementsByTagName("HTML:TEXT");

Could there be a DOCTYPE issue here? My understanding is that
document.getElementsByTagName is supposed to accept a case-insensitive
string, but it's possible that my using a DOCTYPE of xhtml that you must
use lower case. Have you tried lower case?

If that doesn't work, try doing document.getElementsByTagName('*') and
iterating through them. Inspect the name of each element and see if
maybe there's another problem.

My last piece of advice would be to use document.getElementById whenever
possible in preference to document.getElementsByTagName.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGI/Cr9CaO5/Lv0PARAmcFAKCfm+E3JHPkniTuc/V+C/Co2Ie2wACeOs0l
NhsNDU33LsjxZ+A2sxGGMME=
=ZEHQ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: pls help - > how to use document.getElementsByTagName inside html:text

Posted by john lee <sh...@yahoo.com>.
dave,
   
  tks ur reply.
   
  when i test plain html file with input tag
       document.getElementsByTagName("INPUT").length>0
   
  when i test struts html file with html:text tag
   
       document.getElementsByTagName("INPUT").length=0
   
  any clue?
   
  tks
   
  john
   
  
Dave Newton <ne...@yahoo.com> wrote:
  --- john lee wrote:
> plain html file
>  [input] 
> i can use javascript to access "input" tag by 
> document.getElementsByTagName("INPUT");
> 
> but for struts html file
> 
> i can not use javascript to access "input" tag
> by either document.getElementsByTagName("INPUT");

Why not? Do you get an error? just
generates an  [input]  tag.

d.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.

Re: pls help - > how to use document.getElementsByTagName inside html:text

Posted by Dave Newton <ne...@yahoo.com>.
--- john lee <sh...@yahoo.com> wrote:
> plain html file
>       <input type='text' name='part'>
>       i can use javascript to access "input" tag by 
>           document.getElementsByTagName("INPUT");
>    
>   but for struts html file
>       <html:text property="part">
>      i can not use javascript to access "input" tag
> by either document.getElementsByTagName("INPUT");

Why not? Do you get an error? <html:text.../> just
generates an <input type='text'.../> tag.

d.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org