Forum Moderators: open
<a href="javascript:if (somefunc()) document.f.submit();"><img src="bla"></a>function somefunc() {
var clicked = false;
if (clicked) {
alert("Please wait.");
} else {
clicked = true;
return true;
}
return false;
}
to get the cursor change.
It works nice on Mozilla, but on IE, when I make a second click, the browser stops processing and clicked remains true. Is there a way to workaround this?
Thanks for any help, and please, be nice with me, I am a beginner. :)
--
Marcio Merlone
<a onclick="unclick(this);document.f.submit();return false;" href="#"><img src="bla"></a>function unclick(elm){ elm.onclick = function(){/* do nothing */}}
[*< added*]
or without needing a function (maybe unclick is clearer though)
<a onclick="if(!this.clicked){this.clicked=1;document.f.submit()};return false;" href="#">
<img src="bla"></a>
There are a lot of people who would give you a lot of reasons why it's unwise / unethical to have forms that
1. cannot be submit without javascript enabled
2. have submit buttons unnassociated with the form
You could try the
<input type="image"> submit button, or simply give the submit button styled dimensions and image background.
[edited by: Bernard_Marx at 10:06 pm (utc) on Aug. 24, 2004]
The
<input type="image" onclick="bla();">worked as expected. If I use href="#" the page gets scrolled up before submit, and is undesirable.
I understand it is unwise to have a form that cannot be submitted without js, but you also said it is unethical. Why unethical?
onclick="bla();return false;"
Unethical? Maybe it's the wrong word (depending on your politics).
People with accessibility issues will be looking for a 'proper' submit button. They should also expect to easily submit the form by pressing 'enter'.
(When I say looking, I mean 'looking' - they may well be blind)
Your call though, natch :)