Image submit auto enter

Hey people,

I’m curious if anybody knows how to do the following: One of my co-workers set up the submit button as an image on a site I’m helping update (http://abc.virtuelle.ca). Normally if you enter your username and password (nom d’usager et mot de passe) and hit enter, it automatically submits it. With it as an image, you have to click on it. Maybe this isn’t a huge thing, but I’d like to be able to auto submit it on hitting enter with an image as the submit button.

Anybody know how this is done or if it’s possible?

Thanks,

Uth:nerd:

Hmmm, you know what? I honestly have no clue if its possible or not. I think it is, but I don’t know exactly how so I cant help you.

Did you try a google search maybe?

Long time no see BTW!!! Nice to see you again :slight_smile:

Hey,

Yeah it’s been a while since I’ve been on. Work’s been keeping me rather busy, as well as I’m finally getting around to building up my own site. It’s probably about 70% (ish) done, might even have to eventually try and submit it here, although it looks like the competition is pretty stiff.

As the code thing, i think i did find something that might work. My cohort wanted to try it herself, so I guess we’ll see in a day or so if it worked. You were always really good with javascript, whatcha think?:





NS4 = (document.layers) ? true : false;

function checkEnter(event)
{          
           var code = 0;          
           if (NS4)
                       code = event.which;
           else
                       code = event.keyCode;
           if (code==13)
                       document.myform.submit();
}



*input type="text" name="User" size="15" onKeyPress="checkEnter(event)"*

Anywho, thanks for the little welcome back :slight_smile:

Uth :nerd:

It looks pretty good to me, but I don’t see why you have the event in checkenter(event).

Ok Uth… I got my arse up and got working on my own method of this… I came up with this…

<SCRIPT LANGUAGE="javascript">
<!--
var nn = document.layers ? true : false;
var ie = document.all ? true : false;
function isRightKey(eventCap){
	if(ie){
		event.keyCode == 13 ? alert("enter pressed") : null;
	} else {
		eventCap.which == 13 ? alert("netscape enter pressed") : null;
	}
}
nn ? document.captureEvents(Event.KEYDOWN) : document.onkeydown = isRightKey;
-->	
</SCRIPT>

You can replace the alerts with your submit form code, it should work.