We help IT Professionals succeed at work.

Javascript Issue

Richard Korts
on
See attached code. This is generated by php, that's why some of it appears odd.

The issue is there is supposed to be a message (alert) upon page load. There is none (in FireFox). I haven't tried it in IE.

Note the body tag and the onLoad. Note the function conf_msg.

Note that the JavaScript variable pn has a value (it is NOT null).

Why no message?
enter-resev1.htm
Comment
Watch Question

Commented:
You can only assign one method to onLoad. You have two.
<body onLoad="conf_msg(); chk_ad();">

Instead do somthing like this:

<head>
<script language="javascript">

function startMethods()
{
   conf_msg();
   chk_ad();
}

</script>
</head>

<body onLoad="startMethods();">

Open in new window

Commented:
http://www.webreference.com/programming/javascript/onloads/ See link for explanation or search "javascript onload methods" or similar.

Hope this helps.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
Perfect!

FYI, it seemed to work sporadically before. Sometimes we get the message, others not.

Commented:
Thanks! Hopefully that will fix issue.
Richard KortsBusiness Owner / Chief Developer

Author

Commented:
To gregg_s:

Has that always been the case with JavaScript? Just ONE function for an onLoad?

I would swear that I had done that before (and it worked).

Explore More ContentExplore courses, solutions, and other research materials related to this topic.