What in the world is wrong with this script?
-
Can you please tell me what is wrong with this script. Every time I load the HTML document into IE5.5 it gives me an error message that says: "Line: 7 Error: object required" Line 7 contains this: window.status = "X=" + window.event.x + " Y=" + window.event.y; What drives me crazy is that the script is too short to have hidden bugs. Another thing, it seems like setInterval() is what causes the error because when I omit it and make a little modification to the script it works smoothly (look code listing #2). So, could you please tell me what I did wrong? P.S. I know that this posting shouldn't be here and I'm sorry for that. I posted the same message on the web design forum but with no replies so far. I just can't wait to know the problem with the script. Thanks for any suggestions ----- START OF CODE LISTING #1 ----- Test page <!-- function ShowMousePosition() { window.status = "X = " + window.event.x + " Y = " + window.event.y; } --> <!-- window.setInterval("ShowMousePosition()", 1000); --> ----- END OF CODE LISTING #1 ----- ----- START OF CODE LISTING #2 ----- Test page <!-- function ShowMousePosition() { window.status = "X = " + window.event.x + " Y = " + window.event.y; } --> ----- END OF CODE LISTING #2 -----
-
Can you please tell me what is wrong with this script. Every time I load the HTML document into IE5.5 it gives me an error message that says: "Line: 7 Error: object required" Line 7 contains this: window.status = "X=" + window.event.x + " Y=" + window.event.y; What drives me crazy is that the script is too short to have hidden bugs. Another thing, it seems like setInterval() is what causes the error because when I omit it and make a little modification to the script it works smoothly (look code listing #2). So, could you please tell me what I did wrong? P.S. I know that this posting shouldn't be here and I'm sorry for that. I posted the same message on the web design forum but with no replies so far. I just can't wait to know the problem with the script. Thanks for any suggestions ----- START OF CODE LISTING #1 ----- Test page <!-- function ShowMousePosition() { window.status = "X = " + window.event.x + " Y = " + window.event.y; } --> <!-- window.setInterval("ShowMousePosition()", 1000); --> ----- END OF CODE LISTING #1 ----- ----- START OF CODE LISTING #2 ----- Test page <!-- function ShowMousePosition() { window.status = "X = " + window.event.x + " Y = " + window.event.y; } --> ----- END OF CODE LISTING #2 -----
Hello, I'm new to this stuff, but I looked into the documentation for the event object, and this is what I found: "The event object is available only during an event—that is, you can use it in event handlers but not in other code. Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the fromElement and toElement properties are meaningful only when processing the onmouseover and onmouseout events." I think that the interval thing is not an event handler where the event object is valid... Best regards Eddy Steevens DHTML novice
-
Hello, I'm new to this stuff, but I looked into the documentation for the event object, and this is what I found: "The event object is available only during an event—that is, you can use it in event handlers but not in other code. Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the fromElement and toElement properties are meaningful only when processing the onmouseover and onmouseout events." I think that the interval thing is not an event handler where the event object is valid... Best regards Eddy Steevens DHTML novice
They just don't get it, Chris. Just delete the messages.
-
They just don't get it, Chris. Just delete the messages.
-
Hello, I'm new to this stuff, but I looked into the documentation for the event object, and this is what I found: "The event object is available only during an event—that is, you can use it in event handlers but not in other code. Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the fromElement and toElement properties are meaningful only when processing the onmouseover and onmouseout events." I think that the interval thing is not an event handler where the event object is valid... Best regards Eddy Steevens DHTML novice
-
Actually being at a stake burning must have a wretched smell, Maybe just Drawn and Quatered would do.(good historical punishments) Regardz Colin
-
Actually being at a stake burning must have a wretched smell, Maybe just Drawn and Quatered would do.(good historical punishments) Regardz Colin
-
No matter. It was off-topic but we have a happy customer so all's well that ends well. Thanks for taking the time to look into it for him. cheers, Chris Maunder
-
No matter. It was off-topic but we have a happy customer so all's well that ends well. Thanks for taking the time to look into it for him. cheers, Chris Maunder