HTA 文档 GetElementById
HTA documentGetElementById
我从 Windows 桌面创建了以下 HTA 文件 运行。但是,当尝试通过其 ID 检索 HTML 元素时,它会产生错误。有想法该怎么解决这个吗?谢谢
<!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 = "no"
CONTEXTMENU = "no"
BORDERSTYLE = "thin"
/>
<script>
function init()
{
page_table = document.getElementById('page_table')
}
</script>
<STYLE TYPE="text/css">
<!--
body {background:buttonface;color:buttontext;font:10pt Arial;overflow:hidden;}
select {}
-->
</STYLE>
</HEAD>
<BODY onload="init()">
<table id="page_table"></table>
</BODY>
</HTML>
IE 将 ID="page_table"
元素提升为名为 page_table
的全局变量,它不喜欢您重复使用它。
添加var
来覆盖它; var page_table = document.getElementById('page_table');
或者直接使用 page_table
。
我从 Windows 桌面创建了以下 HTA 文件 运行。但是,当尝试通过其 ID 检索 HTML 元素时,它会产生错误。有想法该怎么解决这个吗?谢谢
<!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 = "no"
CONTEXTMENU = "no"
BORDERSTYLE = "thin"
/>
<script>
function init()
{
page_table = document.getElementById('page_table')
}
</script>
<STYLE TYPE="text/css">
<!--
body {background:buttonface;color:buttontext;font:10pt Arial;overflow:hidden;}
select {}
-->
</STYLE>
</HEAD>
<BODY onload="init()">
<table id="page_table"></table>
</BODY>
</HTML>
IE 将 ID="page_table"
元素提升为名为 page_table
的全局变量,它不喜欢您重复使用它。
添加var
来覆盖它; var page_table = document.getElementById('page_table');
或者直接使用 page_table
。