Deere wrote:
I have been trying to put some data in "Text1" in trying to figure out
my problem I'm showing the element comes back as null...why?
<script type="text/javascript">
elem = document.getElementById('Text1');
alert(elem) //..shows null
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<input id="Text1" type="text" />
</form>
</body>
</html>
1. Has the DOM finished loading?
If no, then why expect it to return anything but null. null is the clue
that it is non-existent.
2. You should use existing collections rather than getElementById,
getElementsByTagName, or any other variants.
document.forms['form1'].elements['Text1']; // [object HTMLInputElement]
3. I am not entirely sure what IIS/ASP'ish monstrosity you are going
for, but you should always use clean and valid markup.
--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.