[Javascript] Walking the DOM

Peter Brunone peter at brunone.com
Mon Sep 11 09:20:36 CDT 2006


		   Google for "HTML strip function" and you should get a few good ones.

   Then again, I'm confused as to why you'd need innerText if all you have is text in the link.  The innerHTML property does not return the tag of the element itself; that's outerHTML, which is a whole different issue.

Cheers,

Peter

				From: Terry Riegel riegel at clearimageonline.com

		If o.innerText is IE only, and still possible with lots of work in other browsers could a general function be created to work in all browsers and then added to a library, such as prototype to make life easier for future use?

		Terry

						On Sep 10, 2006, at 4:41 AM, Troy III Ajnej wrote:

						I think you are in need for 

     o=document.getElementById('album01');
     o.innerText =...

(an IE extension introduced ten years ago
having in mind exactly the type of applications
you are building right now),

but since other browsers don't support it
you are left with W3C conditionals and a long
walk...
(meaning count children check for node type identify the correct textnode)
Regards
From: riegel at clearimageonline.com

Correct 

On Sep 8, 2006, at 8:17 PM, Troy III Ajnej wrote:But you don't need to change the href="album01.html". 
Is that correct?

> From: riegel at clearimageonline.com
> If I have the following markup...
> 
>     <li class="anor" id="album01"><a href="album1.html">My Favorite  
> Photos (58)</a></li>
> 
> 
> 
> and... in my javascript I have...
> 
>     o=document.getElementById('album01');
> 
> 
> 
> How do I reference (with the intent of changing) the content of the  
> anchor? My goal is to replace the text with an updated number from  
> the server, but I need a method to replace the text. As a side  
> question should I be using innerHTML, or is there a better method. If  
> anyone is using prototype and knows of a method through that library  
> that would be helpful.
> 
> 
> 
> Thanks,
> 
> Terry


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060911/caa13aaa/attachment.htm>


More information about the Javascript mailing list