469,282 Members | 1,909 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Help needed...js error

This is part of another quest for solution I've posted, but I'm getting no
responses.

My script is:

var popwin;
function launchwin(winurl,winname,winfeatures) {
if (popwin) {popwin.close();}
popwin = window.open(winurl,winname,winfeatures);
popwin.focus();
}

URL: http://www.edbj.itnava.com/brca.html

This works...to an extent. If the window launched is manually closed, and
then an attempt is made to re-open the window, the script fails with the
error: 'Type mismatch (usually a non-object value used where an object is
required) -- if (popwin).' The only way to re-use the function a second
time is to reload the page.

Help! Please... Thanks in advance.
--
Ed Jay (remove 'M' to respond by email)
Jul 27 '06 #1
1 1132
Ed Jay scribed:
>My script is:

var popwin;
function launchwin(winurl,winname,winfeatures) {
if (popwin) {popwin.close();}
popwin = window.open(winurl,winname,winfeatures);
popwin.focus();
}

This works...to an extent. If the window launched is manually closed, and
then an attempt is made to re-open the window, the script fails with the
error: 'Type mismatch (usually a non-object value used where an object is
required) -- if (popwin).' The only way to re-use the function a second
time is to reload the page.

Help! Please... Thanks in advance.
Solution: Use
try {popwin.close();} catch(e) {};
instead of
if (popwin) {popwin.close();}
--
Ed Jay (remove 'M' to respond by email)
Jul 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by stu_gots | last post: by
3 posts views Thread by DM | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.