IT Community - Software Programming, Web Development and Technical Support

How to get all the links on a HTML page with javascript?

This is a discussion on How to get all the links on a HTML page with javascript? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi All, I have a requirement with html links, i want to get all the links using a javascript function, ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 08-10-2007, 06:30 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 278
a.deeban is on a distinguished road
Default How to get all the links on a HTML page with javascript?

Hi All,

I have a requirement with html links, i want to get all the links using a javascript function, after i get the links i have to change the styles for the links if the links ids were started with "SpecialLinks"

Any help will be appreciated.....




thnx.....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-10-2007, 06:32 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 347
Venkat is on a distinguished road
Thumbs up Re: How to get all the links on a HTML page with javascript?

hey deeban,

Try the following script by putting it on page where there are at least one hyperlink

(for example <a href="http://Example.com">Example</a> )

<script>

for (i=0; i < document.links.length; i++)
{

alert(document.links[i].href);

}

</script>
__________________
Venkat
knowledge is Power
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change aspx page to html page? S.Vinothkumar ASP and ASP.NET Programming 4 10-26-2007 11:46 PM
How can I disable links and buttons till the page is loaded? kingmaker HTML, CSS and Javascript Coding Techniques 1 10-15-2007 03:13 AM
HTML links tripnautic HTML, CSS and Javascript Coding Techniques 6 04-05-2007 01:34 PM
Google's updating of page rank, back links oyu2o Google 0 03-11-2007 06:12 AM
Javascript Tutorials, Links and Resources. spid4r HTML, CSS and Javascript Coding Techniques 0 03-08-2007 11:06 PM


All times are GMT -7. The time now is 01:38 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0