开发者

IE 6 & IE 7 printing radio buttons

I have a "calculator" which has two radio buttons (link to form) you select before you perform the calculation. To see my issue, you select the radio button marked "N-12" [to test, we just put "5" in "Slope" and "30" in "Pipe Size" and select "N-12", then calculate], then perform the calculation everything is fine until you print. Because people want to have a paper copy of the calculation, they often print t开发者_JAVA百科he calculated form after it's completed but if you've selected "N-12" and printed the page, it will print with the "Single Wall" radio button selected. I've read that this is a bug and that you can force IE8 to recognize the checked radio button with JS, which is what I did, but it's not working for IE6 & 7. This is the JS that I used to correct this problem for IE8:

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

}

Does anyone know what I need to do to correct this for IE6 and 7.


Yes. Try this (requires jQuery) solution:

// 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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜