File Upload - Change key code for ENTER key on Browse Button

B

bsm

Hi,

I have File Upload control in my form. When I click Enter key, it
triggers "Submit" button event. So I wrote onkeydown function as
follows:

if (window.event.keycode == 13)
{
return false;
}.

hence "Submit" button didn't fire.

But I want to assign Spacebar keycode as follows (so that it will open
file upload window)

if (window.event.keycode == 13) window.event.keycode=32. But this is
not working.

Can anyone plz help me.
 
E

Erwin Moller

bsm said:
Hi,

I have File Upload control in my form. When I click Enter key, it
triggers "Submit" button event. So I wrote onkeydown function as
follows:

if (window.event.keycode == 13)
{
return false;
}.

hence "Submit" button didn't fire.

But I want to assign Spacebar keycode as follows (so that it will open
file upload window)

if (window.event.keycode == 13) window.event.keycode=32. But this is
not working.

What about:
if (window.event.keycode == 32){
// code to fire up your file-upload-thingy.
}

And if you want people using a real internetbrowser to use your app, I
suggest you change your code so it catches those events too.
window.event is IE only...

Regards,
Erwin Moller
 
B

bsm

What about:
if (window.event.keycode == 32){
// code to fire up your file-upload-thingy.

}

And if you want people using a real internetbrowser to use your app, I
suggest you change your code so it catches those events too.
window.event is IE only...

Regards,
Erwin Moller






- Show quoted text -- Hide quoted text -

- Show quoted text -

Thanks a lot. your solution worked well.
 
R

rajesh1040

Hi.
I have a samll doubt regarding file-upload button.
By default there will be "Browse" on type="file" button.
Can i make it to visible as button which bears "Load"(any other word
other than browse).
Please make it clear for me if u knew it.

Thanks in advance
Regards
Rajesh P
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top