我的HTML中有一个这样的代码段。
<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>
当我执行document.getElementsByClassName("scripts")[0].innerText
时,我无法在IE 11
中获得所需的结果。它会截断很多字符。尝试html逃避这一点,但也没有产生任何结果。我发现删除alert('Foo');
或将removeuseragentstylesheet
设为remove
似乎有效!谁能告诉我发生了什么?