Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > File Upload - Change key code for ENTER key on Browse Button

Reply
Thread Tools

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

 
 
bsm
Guest
Posts: n/a
 
      05-10-2007
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.

 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      05-10-2007
bsm wrote:

> 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


>
> Can anyone plz help me.


 
Reply With Quote
 
 
 
 
bsm
Guest
Posts: n/a
 
      05-11-2007
On May 10, 7:01 pm, Erwin Moller
<since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
> bsm wrote:
> > 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
>
>
>
>
>
> > Can anyone plz help me.- Hide quoted text -

>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


Thanks a lot. your solution worked well.

 
Reply With Quote
 
rajesh1040@gmail.com
Guest
Posts: n/a
 
      05-29-2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change the text of browse button in file upload control lale.kat@gmail.com Javascript 8 12-12-2007 07:30 AM
Assigning value to Browse button without using browse button in HTML balakrishnan.dinesh@gmail.com Javascript 0 10-12-2007 06:45 AM
File Upload - Change key code for ENTER key on Browse Button bsm ASP .Net 0 05-10-2007 11:13 AM
Enter Key H*ll, control enter key submit button BrianDH ASP .Net Web Controls 3 01-12-2005 08:29 PM
trigger HTML button by enter ENTER key Matt Javascript 1 03-06-2004 07:01 PM



Advertisments