Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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 internet explorer未读取Js文件_Javascript_Internet Explorer - Fatal编程技术网

Javascript internet explorer未读取Js文件

Javascript internet explorer未读取Js文件,javascript,internet-explorer,Javascript,Internet Explorer,我正在使用JavaScript覆盖我的网站第三方购物车中的一些预设选项。 该脚本在Chrome和Firefox中都能完美运行,但在InternetExplorer中根本不起作用 我的脚本是 警报(“测试”); 函数x(){ var y=document.forms[0]。元素[“pm”]; var z; 对于(var j=0;j我从未听说IE不读取js文件,我通常通过添加一行简单的代码来验证: alert('test'); 检查是否加载了文件 如果您收到警报,则会加载文件,但IE的代码无法正常

我正在使用JavaScript覆盖我的网站第三方购物车中的一些预设选项。 该脚本在Chrome和Firefox中都能完美运行,但在InternetExplorer中根本不起作用

我的脚本是

警报(“测试”);
函数x(){
var y=document.forms[0]。元素[“pm”];
var z;

对于(var j=0;j我从未听说IE不读取js文件,我通常通过添加一行简单的代码来验证:

alert('test');
检查是否加载了文件


如果您收到警报,则会加载文件,但IE的代码无法正常工作,这比IE根本不加载JS的可能性更大。

我从未听说过IE没有读取JS文件,我通常会添加一行来验证:

alert('test');
检查是否加载了文件

如果收到警报,则会加载文件,但IE的代码工作不正常,这比IE根本不加载JS的可能性更大。

尝试:

并查看脚本是否与
警报('test')一起工作;

尝试:


并查看脚本是否与
警报('test')一起工作

可能是脚本在IE下不工作,而不是IE“读取”的。你检查过IE javascript控制台吗?

可能是脚本在IE下不工作,而不是IE“读取”的。你检查过IE javascript控制台吗?

这是IE中的一个错误。如果你提醒innerhtml,你可以看到它是错误的已替换。但浏览器没有反映它

请勾选此问题:

您需要使用更多的DOM函数来修改它。下面是一个生成DOM的小片段(my school Assignment,所以不要介意伪文本):


创建Dom!
函数buildbody()
{
var body=document.getElementsByTagName(“body”)[0];
var theHeader=document.createElement('h1');
var theheaderText=document.createTextNode(“ICT学士学习计划”);
Header.appendChild(HeaderText);
body.appendChild(标题);
var theHeader2=document.createElement('h2');
var theheader2text=document.createTextNode(“简介”);
Header2.appendChild(Header2Text);
身体。附属物儿童(头部2);
var txtN1=document.createElement('p');
var pTxt1=document.createTextNode(
“西方社会以功能良好但变化迅速的技术应用为基础。\n”+
“然而,仅仅专业化已不足以使现代技术人员形成\n”+
'其分支机构发展的全球概览。因此,来自+
“德伦特大学的技术是受过广泛教育的技术专家,着眼于创新,”
“管理和社会环境。理工学院提供四年学习课程\n”+
‘资讯及通讯科技学士’);
txtN1.appendChild(pTxt1);
附肢儿童(txtN1);
var theHeader3=document.createElement('h2');
var theheader3text=document.createTextNode(“课程字符”);
header3.appendChild(header3text);
附肢儿童(头3);
var pTxt2=document.createTextNode(
'工作是在面向问题的项目基础上完成的,通常涉及外部研究,以及\n'+
“实践培训期在相关行业的有趣职位完成。”);
var txtN2=document.createElement('p');
txtN2.appendChild(pTxt2);
附肢儿童(txtN2);
var theHeader4=document.createElement('h2');
var theheader4text=document.createTextNode(“实习”);
header4.appendChild(header4text);
附肢儿童(头4);
var pTxt3=document.createTextNode(
“在三年级和四年级,学生有机会将理论付诸实践。\n”+
'第三年为期五个月的公司培训是计划的一部分,\n+
'四年级学生完成一个学期的毕业设计。两个学期都可以\n'+
“在荷兰或国外度过。”);
var txtN3=document.createElement('p');
txtN3.appendChild(pTxt3);
附体(txtN3);
var linkN1=document.createElement('a');
var linkTxt1=document.createTextNode('单击以获取更多信息');
linkN1.setAttribute('href','http://www.hbo-i.nl/default.aspx?pageID=24');
linkN1.appendChild(linkTxt1);
子体(linkN1);
}

正如您所见,文档正文完全为空,脚本生成了它。您还必须以这种方式更改dom。

这是IE中的一个错误。如果您向innerhtml发出警告,您可以看到它已被替换。但浏览器没有反映它

请勾选此问题:

您需要使用更多的DOM函数来修改它。下面是一个生成DOM的小片段(my school Assignment,所以不要介意伪文本):


创建Dom!
函数buildbody()
{
var body=document.getElementsByTagName(“body”)[0];
var theHeader=document.createElement('h1');
var theheaderText=document.createTextNode(“ICT学士学习计划”);
Header.appendChild(HeaderText);
body.appendChild(标题);
var theHeader2=document.createElement('h2');
var theheader2text=document.createTextNode(“简介”);
Header2.appendChild(Header2Text);
身体。附属物儿童(头部2);
var txtN1=document.createElement('p');
var pTxt1=document.createTextNode(
“西方社会以功能良好但变化迅速的技术应用为基础。\n”+
然而,单纯的专业化已不再是一种趋势
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>Creating the Dom!</title>
    <link rel="stylesheet" type="text/css" href="createDom.css">
    <script type="text/javascript">

   function buildbody() 
   {
        var body = document.getElementsByTagName("body")[0];

        var theHeader = document.createElement('h1');
        var theHeaderTxt = document.createTextNode('Study program Bachelor of ICT');
        theHeader.appendChild(theHeaderTxt);
        body.appendChild(theHeader);

        var theHeader2 = document.createElement('h2');
        var theHeader2Txt = document.createTextNode('Introduction');
        theHeader2.appendChild(theHeader2Txt);
        body.appendChild(theHeader2);

        var txtN1 = document.createElement('p');
        var pTxt1 = document.createTextNode(
        'Western society is based on well functioning but rapidly changing technological applications.\n' +
        'However, mere specialisation is no longer enough modern technologistsneed to be capable of forming \n' +
        'a global overview of the developments in their branch. Accordingly, graduates from the Faculty of \n' +
        'Technology of University Drenthe are broadly educated technologists with an eye for innovation, \n' + 
        'management and social circumstances. The Faculty of Technology offers a four-year study program \n' +
        'Bachelor of ICT.');
        txtN1.appendChild(pTxt1);
        body.appendChild(txtN1); 

        var theHeader3 = document.createElement('h2');
        var theHeader3Txt = document.createTextNode('Course characters');
        theHeader3.appendChild(theHeader3Txt);
        body.appendChild(theHeader3);

        var pTxt2 = document.createTextNode(
        'Work is done on a problem-oriented, project basis, often involving external research, and the \n' +
        'practical training periods are completed at interesting positions in the relevant industries.');
        var txtN2 = document.createElement('p');
        txtN2.appendChild(pTxt2);
        body.appendChild(txtN2); 

        var theHeader4 = document.createElement('h2');
        var theHeader4Txt = document.createTextNode('Internship');
        theHeader4.appendChild(theHeader4Txt);
        body.appendChild(theHeader4);

        var pTxt3 = document.createTextNode(
        'In the third and fourth year students have the opportunity to put the theory into practice. \n' +
        'A company based traineeship of five months in the third year is part of the program and in the \n' +
        'fourth year students work on a final graduation project for one semester. Both periods can be \n' +
        'spent in the Netherlands or abroad.');
        var txtN3 = document.createElement('p');
        txtN3.appendChild(pTxt3);
        body.appendChild(txtN3); 

        var linkN1 = document.createElement('a');
        var linkTxt1 = document.createTextNode('Click for more information');
        linkN1.setAttribute('href','http://www.hbo-i.nl/default.aspx?pageID=24');
        linkN1.appendChild(linkTxt1);
        body.appendChild(linkN1);
   }
    </script>
  </head>
    <body onload="buildbody()">
    </body>
</html>
npm install -g es-check
es-check es5 offendingFile.js