It would be a good idea to document some strange or incorrect behaviours of particular browsers with possible solutions and workarounds.
These will be documented in the following format:
Problem
Give a brief description of the problem
Browser
Which browser it affects (include version number if applicable)
Example
A simple example which demonstrates the problem
Solution
A possible solution or workaround which should not affect other browsers.
Alternative Solution (if applicable)
Another possible solution (if one exists).
Table of contents
- SELECT object's value property doesn't give chosen value (IE) - see below
- Dynamically appended table does not appear on page (IE)
- SELECT object's add() method doesn't append/add options (IE)
- Dynamically appended checkbox element is not checked (IE)
- onload and onunload events do not fire for back, forward and refresh (Opera)
- Setting FORM object's action property causes an error (IE6)
- document.getElementById() gets the wrong element (IE)
Here's one to start us off:
-----------------------------------------------------------------------------------------------------
Problem
The select object's value property doesn't give the selected value
Browser
Internet Explorer
Example
The select drop down:
[HTML]<select name="test" id="test">
<option>1
<option>2
</select>[/HTML]
The Javascript code:
Expand|Select|Wrap|Line Numbers
- var selObj = document.getElementById("test");
- var val = selObj.value;
Give values to the option elements:
[HTML]<select name="test" id="test">
<option value="1">1
<option value="2">2
</select>[/HTML]
Alternative Solution
Change the Javascript to:
Expand|Select|Wrap|Line Numbers
- var selObj = document.getElementById("test");
- var val = selObj.options[selObj.selectedIndex].text;