Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.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
Html HTA追加表行_Html_Windows_Hta - Fatal编程技术网

Html HTA追加表行

Html HTA追加表行,html,windows,hta,Html,Windows,Hta,我有以下代码打算在Windows系统的HTA文件中使用。但是,该表没有使用新行进行更新。有解决办法吗?同样的代码在Chrome浏览器中也能正常工作 <!DOCTYPE html> <HTML> <HEAD> <meta http-equiv="MSThemeCompatible" content="Yes"/> <TITLE> Protos Changer

我有以下代码打算在Windows系统的HTA文件中使用。但是,该表没有使用新行进行更新。有解决办法吗?同样的代码在Chrome浏览器中也能正常工作

<!DOCTYPE html>
<HTML>
    <HEAD>
        <meta http-equiv="MSThemeCompatible" content="Yes"/>
        <TITLE>
            Protos Changer
        </TITLE>
        <HTA:APPLICATION
            ID = "oApp"
            APPLICATIONNAME = "Protos Changer"
            BORDER = "thick"
            CAPTION = "yes"
            ICON = "hw.ico"
            SHOWINTASKBAR = "yes"
            SINGLEINSTANCE = "no"
            WINDOWSTATE = "normal"
            SCROLL = "no"
            SCROLLFLAT = "yes"
            VERSION = "1.1"
            INNERBORDER = "no"
            SELECTION = "no"
            SYSMENU = "yes"
            MAXIMIZEBUTTON = "yes"
            MINIMIZEBUTTON = "yes"
            NAVIGABLE = "yes"
            CONTEXTMENU = "no"
            BORDERSTYLE = "thin"
        />
        <SCRIPT type="text/javascript">
            function init()
            {
                print_stuff('label 1', 'value 1')
                print_stuff('label 2', 'value 2')
                print_stuff('label 3', 'value 3')
                print_stuff('label 4', 'value 4')
                print_stuff('label 5', 'value 5')
                print_stuff('label 6', 'value 6')
            }
            function print_stuff(row_label, row_value)
            {
                var tbl_row = document.createElement('tr')
                var tbl_lbl = document.createElement('td')
                var tbl_val = document.createElement('td')
                var txt_lbl = document.createTextNode(row_label)
                var txt_val = document.createTextNode(row_value)
                tbl_lbl.appendChild(txt_lbl)
                tbl_val.appendChild(txt_val)
                tbl_row.appendChild(tbl_lbl)
                tbl_row.appendChild(tbl_val)
                document.getElementById('page_table').appendChild(tbl_row)
            }
        </SCRIPT>
        <STYLE TYPE="text/css">
        <!--
            body        {background:buttonface;color:buttontext;font:10pt Arial;overflow:hidden;}
            select      {}
            #page_table,td  {border:solid 2px #000;}
            td      {width:10em;height:2em;}
        -->
        </STYLE>
    </HEAD>
    <BODY onload="init()">
        <table id="page_table">
            <tr>
                <td>Label</td>
                <td>Value (old)</td>
            </tr>
        </table>
    </BODY>
</HTML>

Protos变换器
函数init()
{
打印内容(“标签1”、“值1”)
打印内容(“标签2”,“值2”)
打印内容(“标签3”,“值3”)
打印内容(“标签4”,“值4”)
打印内容(“标签5”,“值5”)
打印内容(“标签6”,“值6”)
}
函数打印内容(行标签、行值)
{
var tbl_row=document.createElement('tr')
var tbl_lbl=document.createElement('td'))
var tbl_val=document.createElement('td')
var txt_lbl=document.createTextNode(行标签)
var txt_val=document.createTextNode(行值)
tbl_lbl.appendChild(txt_lbl)
tbl_val.appendChild(txt_val)
tbl_行追加子项(tbl_lbl)
tbl_行。追加子项(tbl_val)
document.getElementById('page_table').appendChild(tbl_行)
}
标签
价值(旧)

我在这里找到了解决方案:

解决方案是创建一个TBODY元素并将行附加到它而不是TABLE元素