| re: object undefined - problem
"s_m_b" <smb20002ns@hotmail.com> wrote in
news:Xns969B794AA1E2Esmb2000nshotrmailcom@216.196. 97.138:
[color=blue]
> here's the code (running from an ASP page):
> <script language = "JavaScript" type="text/javascript">
> function initStuff() {
> var scanWindow = window.open('scanning.htm', 'scanning',
> 'status=yes,height=200,width=450,top=10,left=10,sc rollbars=yes');
> }
> function updatestats (icount,smessage,iupdate,tcount) {
> //var scanStatus = scanWindow.document.form1;
> alert('scanWindowCheck sc=
> ['+scanWindow.document.form1.scanWindowCheck.value + ']');
> var objscan = scanWindow.document.form1 ;
> if (iupdate == "doc") {
> objscan.getElementById("docstats").value = icount ;
> }
> if (iupdate == "fld") {
> objscan.getElementById("fldstats").value = icount ;
> }
> objscan.getElementById("mess").value=smessage;
> objscan.getElementById("total").value=tcount;
> }
> </script>
> initStuff is called after the <body> tag, there is then a loop to give
> 'scanWindow' time to load and render (this runs from server side to
> prevent any load on the client).
> updatestats, on first call, gives out "scanWindow is undefined" as it
> tries to fire the alert box.
> Previously I had an alert that looked for the field value of a small
> form on the page, that is updated from the popup. This appears to
> change correctly when the popup has rendered its own form (form1 in
> this context).
>
> what's going wrong?
>[/color]
solved it - misunderstood the previous instructions about using a object
reference, so had the initStuff function return an object and its fine now! |