Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
I've got an image meant to look like a submit button. I'd like when the image is clicked to get the same click the browser gives when clicking submit.
While I can emulate this by doing something like:
<input type="hidden" name="hello" value="goodbye">
<input type="image" src="pathtoimage" name="do" value="submit">
I'm "missing" the alt tag displaying, plus it's so much easier to just do
<a href="url"><img src="pathtoimage"></a>
is the way to go. This is a submit btn. It behaves the same as an <input type="submit"... and you can also add a alt and title attributes to give your users some popup text.
If, however, you want to submit a form that is on the page, but from an image (click) which is not within that form, then you can do...
<img src="mybutton.gif" onclick="myform.submit();">
But personally, I would stick to the first example, with type="image" if possible.
ASIDE: I've found that a submit button with type="image" is not passed to PHP, key/value pairs?! Am I missing something?!
What I'm trying to do is achieve the same affect as if it was a form, but having it only as an <a href> link.
In other words, it's just an image attached to a link. I still want to hear the "click" sound.
I hope it was clearer.
But it's the 'click' *sound* you are after?! My machine does not make any sound when I click on a (submit) button, whether it's in a form or not, and my machine is pretty much in its default configuration as far as that sort of thing goes.
Whether a users machine makes a click sound on a standard HTML form submit is very much down to the users individual machine - I think!
I did wonder about ASCII code 7 (maybe ) which is historically a 'beep' but that doesn't seem to work!
The other possibility maybe to embed a sound (a small .WAV file) into a page with EMBED/BGSOUND and somehow trigger the sound (change the SRC attribute perhaps) via the onclick event of the link. But it seems like a lot of work for something which 'might' work on 'some' machines - and people could find annoying.