Radio devices do not return to verified status in Firefox

I lost my opinion on why my form of the radio window does not work in Firefox 7.0.1, but works fine in IE, Chrome and Safari. The problem is that radio boxes that are “checked” do not return to what HTML shows.

For example, if I change the temperature setting from "f" to "c" and press "Select", the script action will see the correct values. Then I press Back in FF and update the window, "c" is still selected. As stated, this works as expected in other browsers, but not in FF.

It's hard for me to believe that something is so basic in FF, but the HTML is straightforward.

- Jeff

    <form name="form1" method="POST" action="weather_uom_set.php">        
    <h3>Precipitation</h3>
    <input type="radio" name="precip" value="in" checked="checked"/> Inches (")<br/>
    <input type="radio" name="precip" value="mm" /> Millimeters (mm)<br/>
    <h3>Temperature</h3>
    <input type="radio" name="temp" value="f" checked="checked"/> Fahrenheit (&deg;f)<br/>
    <input type="radio" name="temp" value="c" /> Celsius (&deg;c)<br/>
    <input type="submit" value="Submit" />
    </form>
0
3

, , Firefox , , HTML. , , , Javascript HTML, , script, , / .

+1

check = false "no" checked = "true" "yes".

However, you might think of a similar fix that I came up with to make sure you get the right value when loading the page:

<input type="radio" name="mybox" id="mybox_yes" value="1">
<input type="radio" name="mybox" id="mybox_no" checked="checked" value="0">

<script>

    var mybox = 0; // value 1 or 0 inserted with server side script

    if(mybox == 1){
        var fix_checkbox = function(){
            document.getElementById("mybox_yes").checked=true;
        };
    }
    else
    {
        var fix_checkbox = function(){
        document.getElementById("mybox_no").checked=true;
        };
    }

    setTimeout(fix_checkbox,1000);

</script>

Maybe it’s better to make the logical side of the server, and then print only the desired line:

<script>
    setTimeout(function(){document.getElementById("mybox_no").checked=true;},1000);
</script>
0
source

All Articles