<p>The following code works great in IE, but not in FF or Safari.  I can't for the life of me work out why.  The code is <em>supposed</em> to disable radio buttons if you select the &quot;Disable 2 radio buttons&quot; option.  It should enable the radio buttons if you select the &quot;Enable both radio buttons&quot; option.  These both work...</p>
<p>However, if you don't use your mouse to move between the 2 options (&quot;Enable...&quot; and &quot;Disable...&quot;) then the radio buttons do not appear to be disabled or enabled correctly, until you click anywhere else on the page (not on the radio buttons themselves).</p>
<p>If anyone has time/is curious/feeling helpful, please paste the code below into an html page and load it up in a browser.  It works great in IE, but the problem manifests itself in FF (3 in my case) and Safari, all on Windows XP.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function SetLocationOptions() {
  var frmTemp = document.frm;
  var selTemp = frmTemp.user;
  if (selTemp.selectedIndex &gt;= 0) {
    var myOpt = selTemp.options[selTemp.selectedIndex];
    if (myOpt.attributes[0].nodeValue == '1') {
      frmTemp.transfer_to[0].disabled = true;
      frmTemp.transfer_to[1].disabled = true;
      frmTemp.transfer_to[2].checked = true;
    } else {
      frmTemp.transfer_to[0].disabled = false;
      frmTemp.transfer_to[1].disabled = false;
    }
  }
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form name="frm" action="coopfunds_transfer_request.asp" method="post"&gt;
  &lt;select name="user" onchange="javascript: SetLocationOptions()"&gt;
    &lt;option value="" /&gt;Choose One
    &lt;option value="58" user_is_tsm="0" /&gt;Enable both radio buttons
    &lt;option value="157" user_is_tsm="1" /&gt;Disable 2 radio buttons
  &lt;/select&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;input type="radio" name="transfer_to" value="fund_amount1" /&gt;Premium&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;input type="radio" name="transfer_to" value="fund_amount2" /&gt;Other&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &lt;input type="radio" name="transfer_to" value="both" CHECKED /&gt;Both
  &lt;br /&gt;&lt;br /&gt;
  &lt;input type="button" class="buttonStyle" value="Submit Request" /&gt;
&lt;/form&gt;</code></pre>
</div>
</div>
</p>

[{'answer_id': 6456, 'author': 'Polsonby', 'author_id': 137, 'author_profile': 'https://Stackoverflow.com/users/137', 'pm_score': 2, 'selected': False, 'text': '<p>Well, IE has a somewhat non-standard object model; what you\'re doing shouldn\'t work but you\'re getting away with it because IE is being nice to you. In Firefox and Safari, document.frm in your code evaluates to undefined.</p>\n\n<p>You need to be using id values on your form elements and use <code>document.getElementById(\'whatever\')</code> to return a reference to them instead of referring to non-existent properties of the document object.</p>\n\n<p>So this works a bit better and may do what you\'re after:</p>\n\n<pre><code>Line 27: &lt;form name="frm" id="f" ...\n\nLine 6: var frmTemp = document.getElementById(\'f\');\n</code></pre>\n\n<p>But you might want to check out this excellent book if you want to learn more about the right way of going about things: <a href="http://domscripting.com/book/" rel="nofollow noreferrer">DOM Scripting</a> by Jeremy Keith</p>\n\n<p>Also while we\'re on the subject, <a href="http://bulletproofajax.com/" rel="nofollow noreferrer">Bulletproof Ajax</a> by the same author is also deserving of a place on your bookshelf as is <a href="http://www.amazon.co.uk/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742" rel="nofollow noreferrer">JavaScript: The Good Parts</a> by Doug Crockford</p>\n'}, {'answer_id': 6465, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 1, 'selected': False, 'text': '<p>Why not grab one of the AJAX scripting libraries, they abstract away a lot of the cross browser DOM scripting black magic and make life a hell of a lot easier.</p>\n'}, {'answer_id': 6868, 'author': 'Ricky', 'author_id': 653, 'author_profile': 'https://Stackoverflow.com/users/653', 'pm_score': 4, 'selected': True, 'text': '<p>To get FF to mimic IE\'s behavior when using the keyboard, you can use the keyup event on the select box. In your example (I am not a fan of attaching event handlers this way, but that\'s another topic), it would be like this:</p>\n\n<pre><code>&lt;select name="user" id="selUser" onchange="javascript:SetLocationOptions()" onkeyup="javascript:SetLocationOptions()"&gt;\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/6441', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/232/']