2013-01-07 68 views
0

使用單選按鈕時,避免IE 8中出現拐角問題的正確用法是什麼? 例如用於primefaces radion按鈕的圓角

我有<p:column id="rad" selectionMode="single" />在我的數據表

在IE 8單選按鈕被渲染爲複選框其是在一個方形框。所以爲了解決這個問題我已經用

<h:outputScript library="primefaces" name="jquery/jquery.js"> 
$(document).ready(function() { 
      $('rad').corner();  
    }); 
</h:outputScript> 

但是這並沒有解決問題。

那麼圓形的圓形單選按鈕的正確方法是什麼?

由於

編輯1

<h:head> 

<style type="text/css"> 
    <![CDATA[ 


     .radio input 
{ 
    position: absolute; 
    left: -9999px; 
} 

.label_radio 
{ 
    background: url("/radio_labels.jpg") no-repeat scroll 0 0 transparent; 
    height: 1em; 
    width: 1em; 
} 

.label_radio.r_on 
{ 
    background-position: 0 -18px; 
} 

.radio label 
{ 
    display: inline; 
    padding-bottom: 0.1em; 
    padding-right: 1.9em; 
} 


    ]]> 
</style> 
</h:head> 


<h:outputScript> 
    $(document).ready(function() { 
    alert("1"); 
    $('.rad label').addClass('label_radio'); 
if ($('.rad input').length) { 
    $('.rad input').each(function() { 
     $(this).next('label').removeClass('r_on'); 
    }); 
    $('.rad input:checked').each(function() { 
     $(this).next('label').addClass('r_on'); 
    }); 
}; 

    }); 
</h:outputScript> 

和單選按鈕中的數據表。

<p:column id="rad" selectionMode="single" /> 
+1

圖片是迄今爲止在IE中獲得圓角的最佳解決方案:) – Morpheus

+0

@Morpheus任何示例? – user75ponic

回答

2

這是我正在做的:

CSS:

.radio input 
{ 
    position: absolute; 
    left: -9999px; 
} 

.label_radio 
{ 
    background: url("images/buttons/radio_labels.jpg") no-repeat scroll 0 0 transparent; 
    height: 1em; 
    width: 1em; 
} 

.label_radio.r_on 
{ 
    background-position: 0 -18px; 
} 

.radio label 
{ 
    display: inline; 
    padding-bottom: 0.1em; 
    padding-right: 1.9em; 
} 

的jQuery:

$('.address_type label').addClass('label_radio'); 
if ($('.address_type input').length) { 
    $('.address_type input').each(function() { 
     $(this).next('label').removeClass('r_on'); 
    }); 
    $('.address_type input:checked').each(function() { 
     $(this).next('label').addClass('r_on'); 
    }); 
}; 

HTML:

<div class="address_type clear width"> 
<span class="radio twelvepx"> 
<input id="rbDelAddr" type="radio" value="0" name="AddrType"> 
<label class="label_radio" for="rbDelAddr">Delivery Address</label> 
</span> 
<span class="radio twelvepx"> 
<input id="rbInvAddr" type="radio" value="-1" name="AddrType"> 
<label class="label_radio" for="rbInvAddr">Billing Address</label> 
</span> 
</div> 
+0

'address_type'可以替換成'rad'嗎?我在哪裏可以得到'radio_labels.jpg' – user75ponic

+0

你可以用你想要的任何東西來替換'address_type',因爲它只是一個類名。您可以自己創建'radio_labels.jpg'圖片或在谷歌圖片等上找到。 – Morpheus

+0

我的確完全像您提到的那樣,但我仍然將單選按鈕看作方形框。還有什麼我需要修改? – user75ponic