Possible Duplicate:
Browser Independence issue Code Working for IE but not for Firefox and Chrome
I’m trying to support some old code, and I have an option element inside a Select element in html:
<select onChange="selectURL(this)" style="font-family:Arial; font-size:12;" id="select1" name="select1">
<option ThisCourse="80921" TITLE="- _ ~ : / = ’ ; . , ? ) (.2\" CLASS="" ID="a368890534077645903f263b5ddc105f" VALUE="/Eclass/CourseFrames.asp?vcCourseGUID=a368890534077645903f263b5ddc105f&vcCourseName=%2D+%5F+%7E+%3A+%2F++%3D++%92+%3B+%2E+%2C+%3F++%29+%28%2E2%5C&vcCourseID=80921&NewWin=0&language=">- _ ~ : / = ’ ; . , ? ) (.2\</option>
There’s some javascript running on that site, and it’s trying to do this:
for (i=0; i<SelectElement.options.length;i++)
if (SelectElement.options[i].ThisCourse == CourseID)
SelectElement.selectedIndex = i
In IE, this works fine – it can manage to get to ThisCourse. However, Firefox and Chrome do not understand SelectElement.options[i].ThisCourse
I’m guessing there’s some modern way to get “ThisCourse”, but I don’t know how.
Try using the getAttribute method instead of accessing the property, like this…
IE generally treats property values and attributes alike, however, they are different.