Click to See Complete Forum and Search --> : dynamicly change <a href="link"></a>


jitseschaafsma
03-13-2003, 08:59 AM
I have been trying to get this work.
i have a navigation button that serves as a link.
The navigation button (the resource file) depends on a variable navigation
I am able to change this resource file with the following code:
if ( navigation=="00" || navigation=="01" )
window.document.left.src="leftred.gif"
else
window.document.left.src="leftgreen.gif"

The button is this:
<a href="thelink" name=leftlink><img src="leftgreen.gif" name = left ></a>

now i also want to be able to dynamicly change the link of the button.
So what i need is a javascript (that i will attach to a button with onclick) that changes the link of the button.

To make it even more complicated i want to be able to change the button from a "clickable button to perform a link" to a button with no link at all (as if the href part was not included in the html at all.

Can anyone help me
thanks jitse

Dan Drillich
03-13-2003, 11:29 AM
Please try -


<script>
function takeAction(o) {

o.href = "http://www.iwon.com";

return true;
}
</script>


<a href="#" name=leftlink onclick="return takeAction(this);"><img src="leftgreen.gif" name = left ></a>




Please look also at - http://forums.webdeveloper.com/showthread.php?s=&threadid=5656&highlight=inactive