button click wrongly firing on login page with client script 4 "en

G

Guest

I'm having a problem with a button click event being fired erroneously.

My login.aspx page has the usual username/password boxes.
There is also a link to click when you have filled these, plus a 'remember
me' checkbox.

Further down the page we have a 'email me my password' button.

In addition there is also a small piece of client side script to handle the
user pressing the 'enter' key (this has the same effect as clicking the
'login' link)

What I want to know is - why is the 'email pwd' button event being fired
when the user hits enter?

here is the client script:
==start script
<script language="VBScript">
sub Document_onKeyDown()
if window.event.keyCode = 13 then
Login.submit()
window.event.returnValue=true
end if
end sub

</script>
==end script
 
W

William F. Robertson, Jr.

When you set the event returnValue to true, you are allowing the keydown to
continue propagating up the chain. So you are submitting, then you are
hitting your email pwd button.

Try changing the returnValue to false and see if that works.

HTH,

bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top