...

View Full Version : javascript:newWin() not working for some reason



canadianjameson
05-26-2004, 07:52 PM
haha, i "posted" this 5 mins ago, but forgot i hit preview and closed the window... gj me.

okay, essentially i'm getting an "object expected" error whenever i click on any of the links on this page. i'm trying to use a popup script for each link

heres the code



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Stingray Info</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<script type=text/javascript>
function newWinPDF(urlLoc) {
_winName = "MyNewWindow";
_info = "toolbar=no"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=no"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info);
}
</script>


<script type=text/javascript>
function newWin(urlLoc) {
_winName = "MyNewWindow";
_info = "toolbar=yes"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=yes"; // yes|no
_info += ",scrollbars=yes";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
DispWin=window.open(urlLoc,_winName,_info);
}
</script>


<ul>
<br style="MARGIN-BOTTOM: 2px">
<LI><FONT face=Verdana size=2><a href="javascript:newWin('specsstingray.htm');" style="color:blue;visited:blue;text-decoration:underline" target="_blank">Stingray Engineering Specifications</A></FONT>
<LI><FONT face=Verdana size=2><a href="javascript:newWinPDF('StingrayBrochure.pdf');" style="color:blue;visited:blue;text-decoration:underline" target="_blank">Stingray Brochure</A> </FONT><FONT face=Verdana size=1>(834KB Adobe Acrobat file)</FONT>
<LI><FONT face=Verdana size=2><a href="javascript:newWinPDF('Stingray%20Manual%20Series%20A1.pdf');" style="color:blue;visited:blue;text-decoration:underline"target="_blank">Stingray User's Guide </A></FONT><FONT face=Verdana size=1> (1341KB Adobe Acrobat file)</FONT>
<LI><FONT face=Verdana size=2><a href="javascript:newWinPDF('VSJmountingbands.pdf');" title="Adjustable Stainless Steel Mounting Bands for Round Pipes" style="color:blue;visited:blue;text-decoration:underline" target="_blank">Optional Pipe Mounting Bands</A></FONT><FONT face=Verdana size=1> (300KB Adobe Acrobat file)</FONT>
<LI><FONT face=Verdana size=2><a href="javascript:newWin('howitwk_av.htm');" style="color:blue;visited:blue;text-decoration:underline" target="_blank">How It Works</A></FONT>
</ul>
<p>&nbsp;</p>
</body>
</html>


Here's an unedited version of the popup script



<script type=text/javascript>
function newWin(urlLoc) {
_winName = "MyNewWindow";
_info = "toolbar=no"; // yes|no
_info += ",location=no"; // yes|no
_info += ",directories=no";// yes|no
_info += ",status=no"; // yes|no
_info += ",menubar=no"; // yes|no
_info += ",scrollbars=no";// yes|no
_info += ",resizable=yes"; // yes|no
_info += ",dependent"; // close the parent, close the popup, omit if you want otherwise
_info += ",height=250";
_info += ",width=425";
_info += ",left=465";
_info += ",top=100";
DispWin=window.open(urlLoc,_winName,_info);
}
</script>


any ideas?

oh, ps, the page i gave above is being loaded into a popup using the same script... that may help

sad69
05-26-2004, 08:20 PM
Get rid of the target stuff on each link:


<LI><FONT face=Verdana size=2><a href="javascript:newWin('howitwk_av.htm');" style="color:blue;visited:blue;text-decoration:underline" target="_blank">How It Works</A></FONT>


You don't need it as you're already opening a new page.. I'm not sure why it would cause a problem, but I'm pretty sure that's what it is.

Let me know how it works out for you.

Sadiq.

canadianjameson
05-26-2004, 10:37 PM
you are SO on!

always comming through for me.

Thanks,
-- Jay



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum