Connecting Tech Pros Worldwide Help | Site Map

object undefined - problem

  #1  
Old July 23rd, 2005, 10:34 PM
s_m_b
Guest
 
Posts: n/a
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?
  #2  
Old July 23rd, 2005, 10:34 PM
s_m_b
Guest
 
Posts: n/a

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!
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Child Object to control parent hott5hotj answers 0 March 8th, 2008 09:40 AM
undefined vs. undefined (was: new Array() vs []) VK answers 45 September 12th, 2006 07:15 PM
Is there any 'remove()' method in Array object? brasilino@yahoo.com answers 19 September 6th, 2006 04:25 PM
object Error Ike answers 7 March 28th, 2006 05:55 AM
The "undefined" value matty answers 49 November 23rd, 2005 03:33 AM