当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Android WebView - innerHTML doesn't update value

问题描述:

I use such function to load data to WebView after loading page. Console tells what value of innerHTML is update but on WebView change don't show. In browser console everything is fine.

<script language="javascript" type="text/javascript">

function init_order() {

var elems = document.getElementById("body-id").getElementsByClassName("order_data");

if(arguments.length == elems.length){

console.log("Number of arguments is correct.");

}

else{

console.log("Incorrect number of arguments.");

console.log("Class Tag: "+elems.length);

console.log("Arguments: "+arguments.length);

}

for(i = 0; i < elems.length ; ++i){

var tag = elems[i];

var tagValue = elems[i].innerHTML;

if(tagValue.search("%@") != -1){

var replacedStr = tagValue.replace("%@",arguments[i]);

elems[i].innerHTML = replacedStr;

//console.log(arguments[i]);

console.log("value: "+elems[i].innerHTML);

}

}

// window.location.reload()

}

</script>

分享给朋友:
您可能感兴趣的文章:
随机阅读: