HREF links and javascript: Navigation
Posted by: Rick Strahls WebLog,
on 02 Jan 2007 |
View original
I seem this mistake repeatedly: I have a hyperlink on a page and rather than execute another URL I want it to execute a small bit of JavaScript code. Something like click a button and hide another control on the page:
<a href="javascript:document.getElementById('DragPanel').style.display='none';">Click</a>
This might seem reasonable, but if you run this code youll quickly find out that this doesnt work. Well, the control hides alright but so does everything else...