Welcome to WebmasterWorld Guest from 54.225.20.19

Forum Moderators: open

Message Too Old, No Replies

window.event has no properties

Firefox window.event has no properties

     
2:16 pm on Dec 29, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 3, 2005
posts:187
votes: 0


hi,

im busy with a simple script that uses javascript and works ok but it does give a javascript error in firefox web-developer.

its says...

window.event has no properties
line 23

and thats.....

Key = (document.layers)?e.which:window.event.keyCode;;

full part is :

document.onkeypress = keyhandler;
function keyhandler(e) {
Key = (document.layers)?e.which:window.event.keyCode;;
if( Key == 13 ¦¦ Key == 32){ //13 is ascii value for Enter key 32 is space
convertor9(); //call your function here
}

if( Key == 27 ¦¦ Key == 8 ){ //27 is ascii value for Escape key 8 = backspace
clearConverse(); //call your function here
}
}

can his be solved?

4:58 pm on Dec 29, 2006 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 17, 2005
posts:5003
votes: 20



Key = (document.layers)?e.which:window.event.keyCode;;

Why are you checking document.layers? Get rid of that. Change it to this and see if it works:

Key = (e.which)?e.which:window.event.keyCode;

6:18 pm on Dec 29, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 3, 2005
posts: 187
votes: 0


i have no idea,it was part of the javascript....
but your right...it solved it....
thank you very much Fotiman :)