Connecting Tech Pros Worldwide Help | Site Map

object undefined - problem

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 09:34 PM
s_m_b
Guest
 
Posts: n/a
Default object undefined - problem

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, 09:34 PM
s_m_b
Guest
 
Posts: n/a
Default 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!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.