Use default:
<input type="radio" name="restype" value="resdef" onfocus="docu开发者_StackOverflowment.getElementById('resupload').disabled = true; document.getElementById('resadres').disabled = true;" checked="checked" /><br />
Adres:
<input type="radio" name="restype" value="resadres" onfocus="document.getElementById('resupload').disabled = true; document.getElementById('resadres').disabled = false;" />
<input type="text" name="resadres" id="resadres" disabled="disabled" /><br /><br />
Upload:
<input type="radio" name="restype" value="resupload" onfocus="document.getElementById('resadres').disabled = true; document.getElementById('resupload').disabled = false;" />
<input type="file" name="resupload" id="resupload" disabled="disabled" />
This code works in firefox and IE but not in Chrome. Where is the problem?
onfocus
works when you use tab key to navigate. You should use onchange
event for form elements.
http://jsfiddle.net/5NaH5/
精彩评论