2011-01-31 96 views
2

我有一个“计算器”,它有两个单选按钮(link to form),您在执行计算之前选择。 要查看我的问题,请选择标记为“N-12”的单选按钮[测试,我们在“管道尺寸”中将“Slope”和“30”放入“N”,然后选择“N-12” ],然后执行计算,一切都很好,直到您打印。 因为人们想要计算纸张副本,所以他们经常在完成计算后打印计算表格,但如果选择了“N-12”并打印该页面,则将选择“Single Wall”单选按钮进行打印。 我读过这是一个错误,你可以强制IE8识别与JS选中的单选按钮,这是我做的,但它不适用于IE6 & 7. 这是我用来纠正的JS这个问题对于IE8:IE 6和IE 7打印单选按钮

function toggleRadioCheckbox(el) { 
if (el.getAttribute('checked') != 'checked') { 
    el.setAttribute('checked','checked'); 
} 
else { 
    el.removeAttribute("checked"); 
} 

}

有谁知道我需要做什么来纠正这种对IE6和7

回答

1

是。试试这个(需要jQuery)解决方案:

// We want the change event to trigger when the radio buttons are clicked. 
// Normally IE doesn't 
// trigger change until the radio button has lost focus. 
// Fake it with this click handler 
$('input:radio').click(function() { 
    this.blur(); 
    this.focus(); 
}); 
+0

谢谢托尼,我会尽快给你! – stephmoreland 2011-01-31 19:09:04