Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change the link 1

Status
Not open for further replies.

uconn1981

Programmer
Mar 21, 2005
42
US
I have two radio buttons and a hyperlink with text "Advanced Search". Now I want to realize the following function:

When I select button 1, the link will go to page 1;
When I select button 2, the link will go to page 2.

Is there any javascript I can refer to?

Thanks,

Tim
 
try something like this:
Code:
<script language="javascript">
function changeLink(str) {
   document.getElementById("theLink").href = str;
}
</script>
<body>
<form name="theform">
<input type="radio" name="blah" onclick="changeLink('[URL unfurl="true"]http://www.google.com')"[/URL] checked>Google<br>
<input type="radio" name="blah" onclick="changeLink('[URL unfurl="true"]http://www.tek-tips.com')">Tek-Tips<br>[/URL]
<a href="[URL unfurl="true"]http://www.google.com"[/URL] id="theLink">Go to the page selected above</a>
</form>
</body>

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
headbang.gif
[rockband]
headbang.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top