Fake submit button & return

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm hoping someone can tell me how to do something which, though trivial to
some, I'm really struggling with here. If I have an href, which, through the
magic of CSS, we make appear as a button (a surrogate Submit button no
less), I somehow need to make it pick up when "enter" ("return") is pressed,
so that it acts like a real Submit button. In other words, I think somehow
the href needs to pick up the focus, and if it HAS the focus, will it then
act the same as if it were clicked upon? Below is the construction of the
button, without the css:

              <div class="rvbuttons" style="padding-right:81px;" >
              <a href="javascript:document.frmLogin.submit();"  align="left"
class="rvbutton" style="float:center;" onClick="return

TIA, Ike

Re: Fake submit button & return

Ike wrote:
Quoted text here. Click to load it

So you want something that looks like a submit button and acts like a
submit button - so why don't you use a submit button instead of messing
around with JavaScript / CSS dependant modification of something
designed to do something entirely different?

Re: Fake submit button & return

If I understand you right, you want your submit function to be
triggered by pressing the enter key on the keyboard, right?

Adding javascript to the page like this might be what you need:

    function fetchKey() {
        if (window.event.keyCode == 13) {
            // submit code in here


So, when a key is entered, it checks to see if it's the enter key (13)
and if it is, it does your submit.  I'm also curious why you wouldn't
just use a real submit button.  If it has to be a get instead of a
post, then just add the method="get" attribute to your form.  Just
guessing that that might be one reason why you would want a link
instead of a button.

Site Timeline