Javascript- Hyperlink appear when "yes" radio button selected

Portend

Member
Sep 4, 2000
76
0
0
I am unable to find info to create a script. I am trying to get a link to appear when somebody selects "yes" to a certain radio button on a form. Once it is selected I would like a link to appear beside the radio button that links to a download page. Ultimately I would like it to activate when "yes" on three radio buttons are all selected (different parts of form). The current code I have now is


<head>
<script>
var stringshow = &quot;&quot;

function showlink()
{
if (document.PForm.Scheduler[0].checked ){
stringshow = &quot;jsdfhsk&quot;;
document.write(stringshow);
}
}
</script>
</head>
<body>

<form action=&quot;test.html&quot; name=&quot;PForm&quot;>
<input type=&quot;radio&quot; name=&quot;Scheduler&quot; value=&quot;yes&quot; onclick=&quot;showlink()&quot;>Yes <br>

<input type=&quot;radio&quot; name=&quot;Scheduler&quot; value=&quot;no&quot; checked>No
</form><br>
<script>document.write(stringshow)</script>

</body>

Thanks
 

subhuman

Senior member
Aug 24, 2000
956
0
0
I don't think you can do this with Netscape. At least, using text.

One way to accomplish this is to pre-load an image that looks like your linke (and the rest of the text on the page), and a blank image. Put the blank image on the page next to the radio button, then use an OnSelect to change the image, just like you would with a Javascript Mouseover.

You can do it with IE using text.
 

KB

Diamond Member
Nov 8, 1999
5,406
389
126
Try this code:

<html>
<head>
<script>


function showlink()
{
if (document.PForm.Scheduler[0].checked ){
document.all(&quot;lnk&quot;).style.display=&quot;&quot;;
} else {
document.all(&quot;lnk&quot;).style.display=&quot;none&quot;;
}
}
</script>
</head>
<body>

<form action=&quot;test.html&quot; name=&quot;PForm&quot;>
<input type=&quot;radio&quot; name=&quot;Scheduler&quot; value=&quot;yes&quot; onclick=&quot;showlink()&quot;>Yes <a href=&quot;#&quot; name=&quot;lnk&quot; style=&quot;display: none&quot;>Heres a link that will appear!</a><br>

<input type=&quot;radio&quot; name=&quot;Scheduler&quot; value=&quot;no&quot; onclick=&quot;showlink()&quot; checked>No
</form><br>


</body>
</html>