JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 10th, 2006, 03:01 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Equivlent to -window.event.keyCode- in other than IE browser

hello,

i have been wondering how i would use the window.event code in NN, FF, Opera, exc. does anyone know the equivlent?

colton22

Reply With Quote
  #3  
Old October 11th, 2006, 03:44 PM
crash7997 crash7997 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 3 crash7997 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 51 sec
Reputation Power: 0
You may also look for "Learn Javascript in 24 hours", it has several editions on the web but you have to often cut and paste it to a text file because the ads are badly placed and will not go away. They have an explaination of it in the Chapter Understanding Event Handlers (or something close to that depending on the edition) They also suggest skipping ahead in the book to the chapter on unobtusive scripting to help further with the concept. I am just now getting to that point in teaching myself so I can only refer my source, I hope it is helpful.

If you can't find it try under Sams Publishing you may find it there. I all else fails and you can't find it any other way send me a message and I will send you a way to get the info that I just don't want to broadcast to the world.

Reply With Quote
  #4  
Old October 13th, 2006, 08:52 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
alright thanks, i will look it up

colton22

Reply With Quote
  #5  
Old October 26th, 2006, 04:10 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
I found the barrier breaker!!!!!

Code:
function handleKeyPress(evt) {
  var nbr;
  var nbr = (window.event)?event.keyCode:evt.which;
  alert(nbr);
  return true;
  }
 window.document.onkeydown= handleKeyPress;

From:http://saloon.javaranch.com/cgi-bin...c&f=20&t=004843

heck yea!!!! lol

colton22

Reply With Quote
  #6  
Old October 26th, 2006, 04:33 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13
Odd. The variable was declared twice.

keyCode is supported by more browsers than just IE/Win.

I'd write it like this:
Code:
function handleKeyPress(evt) {
  evt = evt||window.event;
  var nbr = (evt.keyCode)?evt.keyCode:evt.which;
  alert(nbr);
  return true;
}
Comments on this post
colton22 agrees: that does look a little less confusing

Reply With Quote
  #7  
Old October 26th, 2006, 04:47 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
alright, now i am trying a random idea...

i need to check if the SHIFT modifier is down or not, or if caps lock is active, i found out in FF it doesnt matter if shift is down or not, it returns the code for the capitalized letters instead of lowercase, can anyone help on this one?

colton22

Reply With Quote
  #8  
Old October 26th, 2006, 04:50 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13

Reply With Quote
  #9  
Old October 26th, 2006, 04:58 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
ummm... i really didnt understand much of that, is there any atribute to evt in the functions above to tell if it is down??

that is pretty confusing...

colton22

Reply With Quote
  #10  
Old October 26th, 2006, 05:08 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
i got the shift down, not the caps lock though

colton22

Reply With Quote
  #11  
Old October 27th, 2006, 03:12 AM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 140 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 33 m 14 sec
Reputation Power: 13
Quote:
Originally Posted by colton22
ummm... i really didnt understand much of that, is there any atribute to evt in the functions above to tell if it is down??

that is pretty confusing...

No there isn't a property to check that. Hence why I didn't mention it and why he wrote that script.

Yes, it's complicated. Why does that matter?

Reply With Quote
  #12  
Old October 29th, 2006, 08:37 PM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 12
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
lol, im not sure why, it has been a question of mine for a while how to do, i guess im just trying to learn more about javascript and its capabilities.

lol

colton22

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Equivlent to -window.event.keyCode- in other than IE browser


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap