I have a page onload function that needs to read the values from a global variable, but unfortunately the formselements are undefined at page onload.
The page fails to execute the function due to var value being null/undefined.. What is the best way around that???
At page load, I get an error message pointing to the variable definition below saying the “forms.1.store_id is null or not an object”.. If I move the assignment within the function setFocus(), then it is able to recognize the the value, but then I lose the global functionality of it, which I need to be able to refresh and refocus my page..
Please help..Ros
<Script>
var stored=document.forms[1].store_id.value;
function setFocus(){
…
}
….
</Script>
<body onload=”setFocus()”>
…
</body>