PDA

View Full Version : Having trouble with java window open code



Otto
01-24-2008, 07:16 PM
The following code was designed to enlarge my thumbnail images and does so, but at intermediate times will stop working. Any suggestions would be greatly appreciated.





<TITLE>Java Popup Window</TITLE>
<SCRIPT language="JavaScript" type="text/javascript">
<!-- ;
var newwindow = ''
function popitup(url) {
if (newwindow.location && !newwindow.closed) {
newwindow.location.href = url;
newwindow.focus(); }
else {
newwindow=window.open(url,'htmlname','width=200,height=175,resizable=0');}
}

function tidy() {
if (newwindow.location && !newwindow.closed) {
newwindow.close(); }
}

jscheuer1
01-24-2008, 08:39 PM
Don't use:


language="JavaScript"

The language attribute has been deprecated. But that probably isn't the problem. However, other than that, the code looks OK. I can't see the rest of the page and its code though. Scripts don't necessarily happen in a vacuum.

Please post a link to the page on your site that contains the problematic code so we can check it out.

Otto
01-28-2008, 06:16 PM
Thank you for your response. The rest of the code is in PHP, so I am pulling PHP variables from a database to pass to this function.

Otto
01-28-2008, 06:30 PM
FOLLOWING IS COMPLETE CODE:
IF YOU WANT TO SEE IT IN ACTION GOTO: WWW.TEXASCARANDTRUCKACCESSORIES.COM

CLICK ON TRIM THEN SELECT TAHOE.

THANKS FOR HELP.



<HTML>
<HEAD>
<TITLE>Java Popup Window</TITLE>
<SCRIPT type="text/javascript">
<!-- ;
var newwindow = ''


function popitup(url) {
if (newwindow.location && !newwindow.open) {
newwindow.location.href = url;
newwindow.focus(); }
else {
newwindow=window.open(url,'htmlname','width=300,height=225,resizable=0');}
}

function tidy() {
if (newwindow.location && !newwindow.closed) {
newwindow.close(); }
}

</SCRIPT>
</HEAD>

<BODY onUnload="tidy()" >







<?

$pageName = "parts";
$pageTitle = "PARTS AT WHOLESALE PRICING";

include("includes/formatting.php");

dbConnect();



buildHeader(); ?>



<div align="center">


<table width="840" cellspacing="0" cellpadding="0" border="0" style="margin-left:10px">

<tr valign="top">

<td align="left"><strong>NEED PARTS?</strong><br/>Please make a selection from the list below.</td>

</tr>

<tr valign="top">

<td><br/></td>

</tr>

<?

print(" <tr valign=\"top\">\n");

print(" <td align=\"left\">\n");

print(" <table width=\"600\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\">\n");

print(" <tr valign=\"middle\">\n");

print(" <td bgcolor=\"#ebebeb\"><br/></td>\n");

print(" <td bgcolor=\"#ebebeb\"><strong>Image</strong></td>\n");

print(" <td bgcolor=\"#ebebeb\"><strong>Size</strong></td>\n");

print(" <td bgcolor=\"#ebebeb\" width=\"300\"><strong>Description</strong></td>\n");

print(" <td bgcolor=\"#ebebeb\" nowrap=\"nowrap\"><strong>Price</strong></td>\n");

print(" </tr>\n");












$partsTahoeQuery = "SELECT * FROM partsTahoe ";
$partsTahoeQuery .="ORDER BY TahoeID ASC";



$mysql_result = mysql_query($partsTahoeQuery);



while($row = mysql_fetch_row($mysql_result)) {
$TahoeID = $row[0];
$TahoeName = $row[1];
$TahoeDesc = $row[2];
$TahoeImage = $row[3];
$TahoePrice = $row[4];

print(" <input type=\"hidden\" name=\"TahoeID\" value=\"$TahoeID\">\n");
print(" <tr valign=\"middle\">\n");
print(" <td bgcolor=\"#ebebeb\"><input type=\"checkbox\" name=\"partsTahoe" . $TahoeID . "\" /></td>\n");
print(" <td bgcolor=\"#ebebeb\">");

if ($TahoeImage != "") {
print(" <a href=\"javascript:popitup('products/parts/" . $TahoeImage . "')\"><img src=\"products/parts/" . $TahoeImage . "\" border=\"0\" width=\"75\" /></a>\n");
} else {
print("<img src=\"products/no_image_75px.gif\" border=\"0\" width=\"175\" />");
}

print("</td>\n");
print(" <td bgcolor=\"#ebebeb\"><strong>" . $TahoeName . "</strong></td>\n");
print(" <td bgcolor=\"#ebebeb\" width=\"300\">" . $TahoeDesc . "</td>\n");
print(" <td bgcolor=\"#ebebeb\" nowrap=\"nowrap\"><input type=\"text\" name=\"partQty\" value=\"1\" size=\"1\" /> @ $" . number_format($TahoePrice,2) . "/each</td>\n");
print(" </tr>\n");

$rowCount++;

}


print(" <td bgcolor=\"#ffffff\" colspan=\"5\" align=\"center\"><a href=\"cart_cart.php\" target=\"_main\"><img src=\"images/btn_add_cart.gif\" alt=\"\" width=\"219\" height=\"20\" border=\"0\" style=\"margin-top:15px;\" /></a></td>\n");
print(" </tr>\n");
print(" <tr>\n");
print(" <td bgcolor=\"#ffffff\" colspan=\"5\" align=\"center\"><strong>or</strong></td>\n");
print(" </tr>\n");
print(" <tr>\n");
print(" <td bgcolor=\"#ffffff\" colspan=\"5\" align=\"center\"><a href=\"home.php\"><img src=\"images/btn_continue_shopping.gif\" alt=\"\" width=\"219\" height=\"20\" border=\"0\" /></a></td>\n");
print(" </tr>\n");
print(" </table>\n");
print(" </td>\n");
print(" </tr>\n");
print(" <tr><td><img src=\"images/spacer.gif\" width=\"2\" height=\"30\"; border=\"0\"></td></tr>\n");
?>

</table></td>

</tr>

</table>
</form>

</div>

<br />

<? buildFooter(); ?>

Otto
01-28-2008, 11:06 PM
www.texascarandtruckaccessories.com

You need to click the TRIM link then select tahoe.