JavaScript Error: "Could not get the cursor property"
I thought I would pull another error to pull from my logs that I found interesting for a Friday post. (For those that do not read my blog, I log my clientside errors to the server, see this.)
The Error
Browser: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) NAME: Error DESC: Could not get the cursor property. Invalid argument. MSG: undefined
Well the function that the try catch caught this expection contained the following basic code:
myObject.style.cursor = "pointer";
We all know that IE used hand in earilier versions so I changed my code to do this:
try{
myObject.style.cursor = "pointer";
}
catch(eOldIEVersion){
myObject.style.cursor = "hand";
}
Since I have added this fix, the IE 5.5 error has not shown up in my logs. I also tested this on my virtual machine running Windows 98 and IE 5.0. The result showed the hand and did not report an error.
Eric Pascarello
Coauthor of Ajax In Action
Moderator of HTML/JavaScript at www.JavaRanch.com
Author of: JavaScript: Your Visual Blueprint for building Dynamic Web Pages