PDA

View Full Version : disable link onsubmit


nikko50
04-08-2005, 09:29 PM
I would like to disable a hyperlink onsubmit of the form. How can I do this?? Thanks guys.
Tracy:)

warhammerdude20
04-08-2005, 10:13 PM
Like so



<html>
<body>

<form onSubmit="
window.document.all.blah.href='#';return false;">

<input type="submit" onClick="
window.document.all.blah.href='#';alert('its disabled');">

</form>


<a href="blah.html" id="blah">the link</a>

</body>
</html>


That will disable the link(not visually) by clicking the button or submitting the
form(pressing enter). If you want it to look disabled too, go like this:


<html>
<body>

<form onSubmit="
window.document.all.blah.href='#';return false;">

<input type="submit" onClick="
window.document.all.blah.href='#';alert('its disabled');
window.document.all.blah.style.color='#c5c5c5';">

</form>


<a href="blah.html" id="blah">the link</a>

</body>
</html>


Hope that helps