Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 是否有替代innerHTML的方法黑莓浏览器问题_Javascript_Blackberry_Innerhtml - Fatal编程技术网

Javascript 是否有替代innerHTML的方法黑莓浏览器问题

Javascript 是否有替代innerHTML的方法黑莓浏览器问题,javascript,blackberry,innerhtml,Javascript,Blackberry,Innerhtml,是否有替代innerHTML的方法黑莓浏览器问题 黑莓4.6浏览器似乎没有正确使用innerHTML。 它不是替换内容,而是附加内容 function load_activities(){ x$('#dummy').xhr('program.php',{ method:'post', data: 'action=list'. callback: function(){ document.getElement

是否有替代innerHTML的方法黑莓浏览器问题

黑莓4.6浏览器似乎没有正确使用innerHTML。 它不是替换内容,而是附加内容

function load_activities(){
    x$('#dummy').xhr('program.php',{
    method:'post', 
    data:   'action=list'.              
    callback: function(){
            document.getElementById("status2").innerHTML = this.responseText;
        }       
    });

克隆没有子节点的节点,然后添加新内容如何

callback: function () {
    var status2 = document.getElementById("status2");
    var copy = status2.cloneNode(false); // false indicates to not copy children
    copy.innerHTML = this.responseText;
    if (status2.nextSibling) {  // put the copy in the same place as the existing node
        var refchild = status2.nextSibling;
        status2.parentNode.removeChild(status2);
        refchild.parentNode.insertBefore(copy, refchild);
    }
    else { // existing node is the last child, copy can be appended to the end of the list
        var parent = status2.parentNode;
        parent.removeChild(status2);
        parent.appendChild(copy);
    }
}    

我没有办法测试这一点,所以我不确定
cloneNode
是否能按预期工作,只复制标记和属性。希望有帮助。

如果将innerHTML设置为空字符串,会发生什么?它还保留旧东西吗?