Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox Error: evt has no properties on javascript console 1

Status
Not open for further replies.

COTLG

Technical User
Apr 15, 2003
107
US
Hi All,

I get an error on the Firefox javascript console that says:

Error: evt has no properties

This error points to the line starting with two asteriks notations in the code below.

-----------------------------------------------------
var evt;
function mouse_position(){
evt=(evt)?evt:((window.event)?event:null);
}
//Display f_menu
var smenuflag;
function f_menuf(objectID){
var object=document.getElementById('f_menu');
if(document.images){
**if ((smenuflag==1)||((smenuflag==0)&&((((evt.clientX+document.body.scrollLeft)>=174)&&((evt.clientX+document.body.scrollLeft)<=360))&&(((evt.clientY+document.body.scrollTop)>=250)&&((evt.clientY+document.body.scrollTop)<=438)))))
{object.style.visibility='visible';}
else object.style.visibility='hidden';
}
}
--------------------------------------------------------

Please how do I correct this problem?

Best Regards,
Chike.
 
>>window.event

not supported by FireFox. u have to circumvent it:

function Hi(TheEvent)




call Hi like so:
onclick="Hi(event)">



Known is handfull, Unknown is worldfull
 
Hi vbkris,

Please could you be more elaborate and kindly tell me what to do having the code pasted in perspectve. A fly-out submenu is supposed to be displayed or hidden on moving the mouse above a menu item.

Thanks.
Chike.
 
the "event" object cannot be used as used in IE, in all mozilla browsers the event object can only b passed as a parameter, if u want to use it then u have to pass it as a parameter, e.g:

<a href='#' onmouseover="CallMe(event)">TheLink</a>

function CallMe(TheEvent)
{
alert(TheEvent) //u get [object]
alert(window.event) // undefined
}

Known is handfull, Unknown is worldfull
 
Thanks vbkris.

I will try what you advised however I am also using the same script for IE. So what happens to hw it will run on IE.

Chike.
 
it will work on IE too...

Known is handfull, Unknown is worldfull
 
vbkris I understand what you mean but please can you just give me the code?? I am new to javascripting. I want to detect the position of the mouse using the x- and y- coordinates from the evt variable.

Chike.
 
Thank you so much vbkris!!!! I have implemented it and it works very fine!!!

Chike.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top