C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Javascript »

Access an Element of a html document using TagName


Posted Date: 04 Nov 2008    Resource Type: Code Snippets    Category: Javascript
Author: praveenjayapalMember Level: Gold    
Rating: 1 out of 5Points: 5



Hi friends,

Here i explained to access an element of a html document, without handling id or name. we can able to access the element in a document by without using id and name.



function GetTdContent()
{
var TDs = document.getElementsByTagName("td");
var content="";
for (var i = 0; i < TDs.length; i++)
{
content=content+TDs[i].innerHTML+"#";
}
return content; //content consist of all TD's value with Delimiter '#'
}


By using this code, we can directly access the element without the id. According to our specification of TagName we can retive it. We can able to retrive a table from two or more tables from the html document.This will be most useful for dynamically created html(DHTML).


Attachments

  • Access Elements using TagName (22256-4642-access_element_using_TagName.txt)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    Access an Element using TagName  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: how to calculate End date after adding some days to startdate
    Previous Resource: Retrieve value from popup window using javascript
    Return to Discussion Resource Index
    Post New Resource
    Category: Javascript


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use