嗨,我有一個網站使用單選按鈕來選擇選項。如果你點擊按鈕本身,它不起作用(獲得選擇),但如果你點擊按鈕下面的文本,將不勝感激任何幫助。單選按鈕不能在IE瀏覽器中工作9
順便說一句如何將我只適用於IE9修補程序,因爲所有在IE 6-8工作正常。
這是IE9的一個已知問題?
非常感謝
確定這裏是固定的IE9問題的代碼,但現在對於IE 8-6
<script type="text/javascript">
<!--
$(function()
{
inClickFunc=false;
var changeFunc = function()
{
if(!inClickFunc)
{
$(this).parent().click();
}
return false;
};
$("input[type=radio]").bind('change', changeFunc);
$("input[type=radio]").bind('propertychange', changeFunc);
$(".attinner").click(function()
{
inClickFunc=true;
var input=$("input", this);
$(".sub-values", $(this).parents(".middlecontent")).remove();
if(input.attr("checked"))
{
input.attr("checked", false);
}
else
{
input.attr("checked", true);
var div=this;
$.get("/js/product_options.php", {product_id: 1130, value_id: $(input).attr("value")}, function(result)
{
if(result)
{
$(div).parent().nextAll(".clear").eq(0).after(result);
}
});
}
inClickFunc=false;
});
$('.sub-value').livequery('click', function()
{
$("input", this).attr("checked", true);
});
$("[name=product]").submit(function()
{
var submit=false;
$.ajax(
{
type: 'POST',
async: false,
url: '/js/validate_product.php',
data: $(this).serialize(),
success: function(msg)
{
if(msg.length==0)
{
submit=true;
}
else
{
submit=false;
alert(msg);
}
}
});
return submit;
});
/*$(".middlecontent").each(function() {
$options = $(this).find('.attinner');
if($options.length == 1)
{
$options.click()
}
});*/
});
-->
</script><h2>Size (Height x Width x Depth)</h2>
<div class="middlecontent">
<div class="attribute-wide">
<div class="attinner">
<input type="radio" title="Values" name="values[23]" class="required" value="5325"><div class="attvalue">
1981mm x 686mm x 35mm<br>78" x 27" x 1.38"<br><span class="size-price">(£109.00)</span> </div>
</div>
</div>
<div class="attribute-wide">
<div class="attinner">
<input type="radio" title="Values" name="values[23]" class="required" value="5324"><div class="attvalue">
1981mm x 762mm x 35mm<br>78" x 30" x 1.38"<br><span class="size-price">(£109.00)</span> </div>
</div>
張貼一些代碼。 – JackWilson
這是一些代碼,這已經解決了IE9的問題,但現在不能在IE 8-6 – user1041401
你知道你可以使用'標籤'來分配一個可點擊的文本到單選按鈕,而不必寫一行的Javascript ?它會讓你的生活更輕鬆,因爲你不必擔心事件冒泡和所有的東西,你只需要處理標籤上的點擊。你可以將標籤放在標籤內,這樣你就可以將其顯示爲一個塊元素來替換您現在獲得的'attinner' div。 – GolezTrol