Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 590007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:29:00+00:00 2026-05-13T15:29:00+00:00

The following declaration at the window level: var event; // for IE var event

  • 0

The following declaration at the window level:

    var event; // for IE
    var event = "anything"; // for Chrome

will destroy the event object as used here:

    <div onMouseOver = "alert(event.type);">Mouseover Div</div>

Firefox does not seem phased by either declaration.

I realize that declaring a variable with the name “event” is bad code but I am curious about the technical difference here, e.g. that the use of var in IE reinitializes the variable to null, whereas Chrome will not overwrite with a var declaration unless a value is explicitly assigned, and maybe FF holds the event object outside of the window’s var declaration scope altogether.

This is more of a curiosity. I ran into a bug in IE on a site outside of my control that was caused by this and the more I looked into the more I saw subtle differences between browsers. Just wondering if anyone had any insights here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:29:00+00:00Added an answer on May 13, 2026 at 3:29 pm

    In IE, event is a property of the window object and is used in event handlers functions to access the event being handled. In other browsers such as Firefox, the situation is that in an event handler attribute, the JavaScript code inside the attribute is called as though it forms the body of a function into which has been passed a parameter called event that corresponds to the event being handled. So in

    <div onmouseover="alert(event.type);">Mouseover Div</div>
    

    the mouseover code is effectively

    function(event) {
        alert(event.type);
    }
    

    and the event parameter overrides any event declared in a containing scope, whereas in IE, it’s

    function() {
        alert(event.type);
    }
    

    and the event identifier is resolved as a property of the global object (i.e. window).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following error: No declaration of window found in interface. Though when
Consider the following declaration as part of SomeClass private Set<String> blah = new HashSet<String>();
I have a function with the following declaration: void cleanValid(int valid[][4], int &size, int
I have a class with the following declaration of the fields: public class Game
I'm trying to compile some code which contains the following declaration, because I would
I'm writing to a text file using the following declaration: void create_out_file(char file_name[],long double
In my head.phtml , I have following declaration for getting a menu work. <script
i have the following property declaration Public Property IsAreaSelected() As Integer Get Return If(ViewState(IsAreaSelected)
I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector,
I have the following method declaration: public static bool SerializeObject<T>(string filename, T objectToSerialize){ I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.