Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 适用于firefox,但不适用于IE8_Javascript_Firefox_Internet Explorer 8 - Fatal编程技术网

Javascript 适用于firefox,但不适用于IE8

Javascript 适用于firefox,但不适用于IE8,javascript,firefox,internet-explorer-8,Javascript,Firefox,Internet Explorer 8,这在firefox中运行良好,但只关闭第一页,然后在IE8中中断。IE8中的Firebug表示x.item(o)为空。我不明白为什么这在firefox中有效,但在IE中无效。谢谢你的帮助 pager(x=document.getElementsByName("pg1")); function pager( x ) { var curr = document.getElementById('showing'); $(curr).fadeOut('fast'); curr.

这在firefox中运行良好,但只关闭第一页,然后在IE8中中断。IE8中的Firebug表示
x.item(o)
为空。我不明白为什么这在firefox中有效,但在IE中无效。谢谢你的帮助

pager(x=document.getElementsByName("pg1"));

function pager( x ) {
    var curr = document.getElementById('showing');
    $(curr).fadeOut('fast');
    curr.id = 'hide';
    $(x).fadeIn('slow');
    x.item(0).id ='showing';
}
if(x.item(0).id=NULL)

那是一项任务。您需要
==
进行比较

(大写字母中的NULL是什么?元素的
id
属性将不会是
NULL
;如果未设置,它将是一个空字符串。)


在我看来,您最好使用jQuery的方法。

不,这是我添加到测试中的内容,但我想这甚至是错误的。整个声明都不在里面,这是我在firebug里得到的。当我发出警报(x.item(0.id))时,firefox中的“item(…)”为null或不是对象”;ID设置为“显示”后,警报消息会将ID显示为“显示”,但不会显示在IE8中。我很确定问题在于如何将ID设置为“显示”。我不知道还有别的办法。