Javascript IE innerText未按预期工作?
我的HTML中有这样一个代码片段Javascript IE innerText未按预期工作?,javascript,internet-explorer,innertext,Javascript,Internet Explorer,Innertext,我的HTML中有这样一个代码片段 <div class="scripts" style:"display:none"> Test.settings = { width: 1050, onready: function(object) { Test.objects = Test.objects || []; Test.objects.push(object); }, authenticationCreden
<div class="scripts" style:"display:none">
Test.settings = { width: 1050,
onready: function(object) { Test.objects = Test.objects || []; Test.objects.push(object); },
authenticationCredentials: {username: "name", password: "password"},
splashScreen:{background:false},
widgets:{sidebar: false}};
Test.create('Test', 'http://192.168.5.80', Test.settings);
dosomething = function(value){
object=Test.objects[0];object.removeuseragentstylesheet('header');
object.removeuseragentstylesheet('background');
alert('Foo');
if(!value){return;}
var url = "app/controller/handler";
var params = "&idn=" + value;
Myajax.doPost(url,
params,
function(json){object=Test.objects[0];object.removeuseragentstylesheet('header');object.removeuseragentstylesheet('background');
console.log(json);
var result = JSON.parse(json);
value = '@page{background-image: url("' + value + '"); background-repeat: no-repeat; background-position: 2.5cm 2.5cm;}'
if(result){
object.adduseragentstyles(background, 'print', 'background');
object.adduseragentstyles(result['letterhead'], 'print', 'header');
}});}
</div>
Test.settings={width:1050,
onready:function(object){Test.objects=Test.objects | |[];Test.objects.push(object);},
authenticationCredentials:{用户名:“名称”,密码:“密码”},
splashScreen:{background:false},
小部件:{sidebar:false};
Test.create('Test','http://192.168.5.80,测试设置);
dosomething=函数(值){
object=Test.objects[0];object.removeuseragentstylesheet('header');
removeuseragentstylesheet('background');
警报(“Foo”);
如果(!value){return;}
var url=“应用程序/控制器/处理程序”;
var params=“&;idn=“+值;
Myajax.doPost(url,
params,
函数(json){object=Test.objects[0];object.removeuseragentstylesheet('header');object.removeuseragentstylesheet('background');
log(json);
var result=JSON.parse(JSON);
value='@page{background image:url(“+value+”);背景重复:无重复;背景位置:2.5cm 2.5cm;}'
如果(结果){
adduseragentstyles(背景,“打印”,“背景”);
adduseragentstyles(结果['letterhead','print','header');
}});}
当我执行
document.getElementsByCassName(“脚本”)[0].innerText时,我在IE 11
中没有得到所需的结果。它会截断很多字符。也尝试了html转义,但也没有产生任何结果。我观察到删除alert('Foo')
或将removeuseragentstylesheet
设置为remove
似乎有效!有人能告诉我发生了什么吗?尝试使用textContent
而不是非标准的innerText
,也许在IE中可能更容易预测。我尝试了这两种方法,只是为了确保我不愚蠢!这是你的测试小提琴谢谢你的小提琴,你知道你能做到吗!由于某些原因,这在我的虚拟IE中没有打开,由于一些网络问题,这对你来说是可复制的吗?什么是不打开的?我这里没有IE(OSX)