Change text/href of a link with JavaScript?


#1

Hello, all! smile

I was wondering if I could change the text of a link with a JavaScript. I want to set it up with a JavaScript function so that when A link is clicked on, the text of that link changes and it points to a different function.

Any suggestions? Thanks.


#2

Hey,

You can easily do this in IE 4 + and NS 6. However, for NS 4, you'd have to use layers, and reqrite the whole <a> tag:

<a href="javascript:someFunction()" onclick="this.innerHTML='New Text';this.HREF='javascript:someNewFunction()'">Old Text</a>

aDog cool


#3

aDog,

Thanks! The solution works well, but after consideration of the NS4 browser, i decided to abandon the thought.

I was actually just playing around to see if i COULD in fact do this. You helped me.

Thanks again! smiley


#4