自定义Javascript无法在Internet Explorer中运行,但可以在Chrome中运行. [英] Custom Javascript not working in Internet Explorer, but working in Chrome.
问题描述
我正在尝试将一些JavaScript代码嵌入到我的SharePoint页面中.以下是在Chrome浏览器中工作正常的代码,但在Internet Explorer中无法正常工作.当我尝试访问IE 11中的页面时,该页面上的所有超链接都无法正常工作. Chrome没有这些问题 并且工作正常.
我查看了IE中的控制台,发现的是这些错误:http://imgur.com/a/033zX
下面的HTML和样式表:
< html> < head> < link rel ="stylesheet" href =" style.css"> </head> <身体> < center> < img src ="aFAV17i.png" usemap ="#image-map"> </center> <地图名称=图像地图"> < area target ="" alt ="testst" title ="testst" href ="#first" coords ="374,539,381,721,514,688,648,586,516,488" shape ="poly" < area target ="" alt ="eee" title ="eee" href =#second" coords ="101,603,201,681,372,719,369,541,239,480,102,594" shape ="poly" < area target ="" alt ="xxx" title ="xxx" href ="#third" coords ="92,595,22,468,12,298,197,342,233,481" shape ="poly" < area target ="" alt =" title =" href =#four" coords ="15,296,82,146,196,51,283,215,195,328". shape ="poly" < area target ="" alt =" title =" href =#five" coords ="204,45,364,7,508,38,433,206,290,209" shape ="poly" < area target ="" alt =" title =" href =#six" coords ="516,42,439,212,528,317,710,273,645,137,646,137,645,137" shape ="poly" < area target ="" alt =" title =" href =#sevenn" coords ="530,328,713,278,719,433,655,576,510,469" shape ="poly" </map> < div id ="first" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p>第一</p> < p>此模式框有很多用例. </div> </div> < div id ="second" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p>第二< p < p>此模式框有很多用例. </div> </div> < div id =第三" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p>第三< p < p>此模式框有很多用例. </div> </div> < div id =四个" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p>四</p> < p>此模式框有很多用例. </div> </div> < div id ="5" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p>五个</p> < p>此模式框有很多用例. </div> </div> < div id =六个" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p> 6</p> < p>此模式框有很多用例. </div> </div> < div id ="sevenn" class ="modalDialog"> < div> < a href ="#close" title =关闭" class ="close" X/a. < h2>标题</h2> < p> Sevenn< p < p>此模式框有很多用例. </div> </div> </body> </html>
.modalDialog { ; 字体家族:Arial,Helvetica,sans-serif; 最高:0; 正确:0; 底部:0; 左:0; 背景:rgba(0,0,0,0.8); z-index:99999; 不透明度:0; -webkit-transition:不透明度250ms缓入; -moz-transition:不透明度250ms缓入; 过渡:不透明度250ms缓解; 指针事件:无; } .modalDialog:target { 不透明度:1; 指针事件:自动; } .modalDialog> div { 宽度:400像素; ; 保证金:10%自动; 填充:5px 20px 13px 20px; border-radius:10px; 背景:#fff; 背景:-o-linear-gradient(底部,rgb(245,245,245)25%,rgb(232,232,232)63%); 背景:-moz-linear-gradient(底部,rgb(245,245,245)25%,rgb(232,232,232)63%); 背景:-webkit-linear-gradient(底部,rgb(245,245,245)25%,rgb(232,232,232)63%); } .关闭 { 背景:#606061; 颜色:#FFFFFF; 行高:25px; ; 右:10px; 文本对齐:居中; 顶部:10px; 宽度:24像素; 文字修饰:无; font-weight:粗体; -webkit-border-radius:12px; -moz-border-radius:12px; border-radius:12px; } img.map,地图区域{ 大纲:无; } .close:hover {背景:#57a2d1; }
在脚本标签中添加以下标签.
<元http-equiv ="X-UA-Compatible" content ="IE = EmulateIE11"; />
---------------------------- ------------------------------------------------ >
谢谢
Lalith
---------------------------- ------------
请标记为 回答,如果该帖子解决了您的问题
I'm trying to embed some javascript code into my SharePoint page. Below is the code that is working fine in Chrome but not Internet Explorer. When I try to access the page in IE 11, all the hyperlinks on the page do not work. Chrome has none of these issues and works fine.
I looked through console in IE and these are the error it found: http://imgur.com/a/033zX
HTML and style sheet below:
<html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <center> <img src="aFAV17i.png" usemap="#image-map"> </center> <map name="image-map"> <area target="" alt="testst" title="testst" href="#first" coords="374,539,381,721,514,688,648,586,516,488" shape="poly"> <area target="" alt="eee" title="eee" href="#second" coords="101,603,201,681,372,719,369,541,239,480,102,594" shape="poly"> <area target="" alt="xxx" title="xxx" href="#third" coords="92,595,22,468,12,298,197,342,233,481" shape="poly"> <area target="" alt="" title="" href="#four" coords="15,296,82,146,196,51,283,215,195,328" shape="poly"> <area target="" alt="" title="" href="#five" coords="204,45,364,7,508,38,433,206,290,209" shape="poly"> <area target="" alt="" title="" href="#six" coords="516,42,439,212,528,317,710,273,645,137,646,137,645,137" shape="poly"> <area target="" alt="" title="" href="#sevenn" coords="530,328,713,278,719,433,655,576,510,469" shape="poly"> </map> <div id="first" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>First</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="second" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>Second</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="third" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>title</h2> <p>Third</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="four" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>Four</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="five" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>Five</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="six" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>Six</p> <p>There are many use cases for this modal box.</p> </div> </div> <div id="sevenn" class="modalDialog"> <div> <a href="#close" title="Close" class="close">X</a> <h2>Title</h2> <p>Sevenn</p> <p>There are many use cases for this modal box.</p> </div> </div> </body> </html>
.modalDialog { ; font-family: Arial, Helvetica, sans-serif; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.8); z-index: 99999; opacity:0; -webkit-transition: opacity 250ms ease-in; -moz-transition: opacity 250ms ease-in; transition: opacity 250ms ease-in; pointer-events: none; } .modalDialog:target { opacity:1; pointer-events: auto; } .modalDialog > div { width: 400px; ; margin: 10% auto; padding: 5px 20px 13px 20px; border-radius: 10px; background: #fff; background: -o-linear-gradient(bottom, rgb(245,245,245) 25%, rgb(232,232,232) 63%); background: -moz-linear-gradient(bottom, rgb(245,245,245) 25%, rgb(232,232,232) 63%); background: -webkit-linear-gradient(bottom, rgb(245,245,245) 25%, rgb(232,232,232) 63%); } .close { background: #606061; color: #FFFFFF; line-height: 25px; ; right: 10px; text-align: center; top: 10px; width: 24px; text-decoration: none; font-weight: bold; -webkit-border-radius: 12px; -moz-border-radius: 12px; border-radius: 12px; } img.map, map area{ outline: none; } .close:hover { background: #57a2d1; }
Add below tag in Script tags.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11" />
----------------------------------------------------------------------------
Thanks
Lalith
----------------------------------------
Please mark as Answer, if this post solves your issue
这篇关于自定义Javascript无法在Internet Explorer中运行,但可以在Chrome中运行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!