jQuery UI Button在IE 7上不起作用

时间:2013-01-10 15:27:40

标签: javascript jquery internet-explorer-7

我有这段代码:

<script type="text/javascript" src="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/js/jquery-ui-1.8.16.custom.min.js"></script>
<link type="text/css" href="<?=$path?>common/_LIB/3rd/jquery/jquery-ui-1.8.16/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />

<script>
    $(function() {
            $('.button,.button floatRight').button();
    });
</script>

<a class="button floatRight" href="handset_list.php"><?=$reprint?></a>

并且Chrome和FF,IE 9都很好,但在IE 8和IE 7上,我看不到上述链接的按钮。

3 个答案:

答案 0 :(得分:2)

您在jQuery选择器中的代码中有错误。没有名为“floatRight”的标记名称。 试试这个:

$('.button').button();

答案 1 :(得分:1)

请尝试以下代码:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

答案 2 :(得分:0)

你可能意味着

$(function() {
        $('.button,.button floatRight').button();
});

标记属性中的空格表示有两个类。在您的情况下,您尝试定位的按钮有两个类:buttonfloatRight。因此有两个点。

修改
我发现了其他内容:函数$("#something").button();多次调用$.data。根据{{​​3}},IE只对部分属性的自定义数据提供部分支持,因此,它可能无法像jQuery UI开发人员认为的那样在IE 7中工作。许多对$.data的调用让我想到{ {1}}功能有点依赖它(但我还没理解它,我只是快速浏览一下)。如果是这样,那可能就是原因。如果你真的需要IE 7支持,我建议使用IE 7是最常用的IE时发布的jQuery UI构建,尽管这可能不支持你现在使用的所有功能。我只想让IE 7用户看到一个锚点。锚点有什么坏处?