问题
I know that I should use its alternative "onclick" for "checkboxes", to overcome this problem in "Safari" and "Chrome". But what should I do if I want to use an "onchange" event for a "fieldset" (a group of checkboxes)?
回答1:
It seems that assigning "onchange" event after page load using "javascript" , works! Here is an example:
<script type="text/javascript">
window.onload = function() {
var fieldsets = document.getElementsByTagName("fieldset");
for( i = 0 ; i < fieldsets.length ; i++ ) {
fieldsets[i].onchange = function() {
Validate(); // Calling sample function
}
}
}
function Validate() {
// Sample function content
}
</script>
来源:https://stackoverflow.com/questions/5598120/onchange-event-not-firing-in-safari-family-browsersfor-a-fieldset