Reputation: 2651
I've created the following HTA file to be run from the Windows Desktop. However, it produces an error when trying to retrieve an HTML element by its ID. Any ideas on how to fix this? Thanks.
<!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>
Upvotes: 1
Views: 1312
Reputation: 175876
IE promotes the ID="page_table"
element to a global variable named page_table
and it dislikes you reusing this.
Add var
to override this; var page_table = document.getElementById('page_table');
Or just use page_table
right off the bat.
Upvotes: 1