delray...@gmail.com wrote:
I'm using:
document.getElementById("mylink").childNodes[0].nodeValue = "New
Text";
To change the text value of a link that I've created.
How can I do something similar to change the onclick event?
(doesn't work)
document.getElementById("mylink").onClick="alert(' test')";
Thanks,
Cliff.
It's 'onclick' (lower-case) for one thing.
You need to assign either a actual function (object) or a pointer:
document.getElementById("mylin*k").onclick=functio n(){alert('test');};
You could, naturally, just use document.createElement('a') to make a
new Link, set its attributes, and call .replaceChild().