[英]Unexpected call to method or property access. in JQUERY
My code which is giving error in IE8 我的代码在IE8中给出了错误
$(function(){
$.ajax({url:"http://localhost/css/register.txt",
cache : false,
success:function(ris){$("<style></style>").appendTo("head").html(ris);//culprit statement
},
error:function(){}
});
});
It seems that jQuery doesn't resolve the browser compatibility issues regarding setting the content of a <style>
element via innerHTML
. 似乎jQuery不能解决与通过
innerHTML
设置<style>
元素的内容有关的浏览器兼容性问题。
I believe this will work instead... 我相信这可以代替...
$("<style>" + ris + "</style>")
Internet Explorer does not allow setting of innerHTML
on <style>
elements. Internet Explorer不允许在
<style>
元素上设置innerHTML
。 See How to create a <style> tag with Javascript 请参见如何使用Javascript创建<style>标签
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.