| View previous topic :: View next topic |
| Author |
Message |
sundarraj_mca
Joined: 14 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 8:16 am Post subject: how to get parameters from a hyperlink using javscript |
|
|
hai developers
i have a problem in my site. i used tabbed panel in my site and when ever i click on a hyperlink in any tab when page gets refreshed default tab is displayed. i found that default value is 0 in JS. i kn ow how to handle it, but i dont know how to get values from a href using javascript
how set a value for a href so that in JS i can get that value using getElemetById method |
|
| Back to top |
|
 |
|
|
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 715 Location: Cebu City Philippines
|
Posted: Sat May 24, 2008 8:31 am Post subject: Re: how to get parameters from a hyperlink using javscript |
|
|
| Code: |
window.onload=function()
{var lnks=document.getElementsByTagName('a');
for(var i=0;i<lnks.length;i++)
{
lnks[i].onclick=function()
{alert(this.href);return false;}
}
}
|
This code will alert whatever value is inside the href attribute during onclick. See if it helps  |
|
| Back to top |
|
 |
sundarraj_mca
Joined: 14 May 2008 Posts: 19
|
Posted: Sat May 24, 2008 10:08 am Post subject: Re: how to get parameters from a hyperlink using javscript |
|
|
| how to know which link is clicked using javscript |
|
| Back to top |
|
 |
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 715 Location: Cebu City Philippines
|
Posted: Sat May 24, 2008 10:13 am Post subject: Re: how to get parameters from a hyperlink using javscript |
|
|
What information do you need to show?..and btw, how do we know that the link is clicked?..do you want to alert his chronological order, Example, this is the link 1, this is link2....or you mean something else
I don't get it. I'm confused (nothing new)  |
|
| Back to top |
|
 |
|