Jump to content


Photo

COM getElementById Problem


  • Please log in to reply
4 replies to this topic

#1 Ken1

Ken1
  • Members
  • 22 posts

Posted 18 June 2012 - 11:29 PM

th

#2 tank

tank
  • Members
  • 4101 posts

Posted 18 June 2012 - 11:52 PM

pwb.document.getElementById("companyname").[color=#800000]innertext[/color]


#3 Ken1

Ken1
  • Members
  • 22 posts

Posted 19 June 2012 - 12:21 AM

Thank you, It works. When should I use innertext? and when should I use just pwb.document.getElementById?

#4 tank

tank
  • Members
  • 4101 posts

Posted 19 June 2012 - 12:31 AM

Remarks
The innerText property is valid for block elements only. By definition, elements that do not have both an opening and closing tag cannot have an innerText property.

So for example not for input tags or br etc it is a property that sets or returns text
pwb.document.getElementById returns an IHTMLElement which has properties methods and objects as an element

#5 Ken1

Ken1
  • Members
  • 22 posts

Posted 19 June 2012 - 12:54 AM

Remarks
The innerText property is valid for block elements only. By definition, elements that do not have both an opening and closing tag cannot have an innerText property.

So for example not for input tags or br etc it is a property that sets or returns text
pwb.document.getElementById returns an IHTMLElement which has properties methods and objects as an element


oh I understand it now, thanks