Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

null or not an object

Status
Not open for further replies.

cisco999

Programmer
Apr 26, 2001
66
0
0
US
The following script generates a "null or not an object" on line 4. I've used this syntax before to retrieve a value from the page. I'm not seeing the problem. Thanks for the help!

<HTML>
<HEAD>
<script language="JavaScript">
alert('Update successful for PO '+document.myForm.po.value);</script>
</HEAD>
<BODY>
<FORM name="myForm" method="post">
<DIV align="center">
<SPAN name="namedTag"></SPAN>
<SPAN name="po_text">PP40141</SPAN><input name="po" type="hidden" value='PP40141'>
</DIV>
</FORM>
</BODY>
</HTML>
 
That's because it doesn't exist yet. Wait until after it has loaded before calling it:
Code:
<HTML>
<HEAD>
<script language="JavaScript">
[red]function init(){[/red]
            alert('Update successful for PO '+document.myForm.po.value);
[red]}[/red]
</script>
</HEAD>
<BODY[red] onload="init()"[/red]>
<FORM name="myForm" method="post">
            <DIV align="center"> 
            <SPAN name="namedTag"></SPAN> 
            <SPAN name="po_text">PP40141</SPAN><input name="po" type="hidden" value='PP40141'> 
            </DIV> 
</FORM>
</BODY>
</HTML>

Adam
 
That was too easy! I was looking at it too long. Many thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top