...

View Full Version : GRID Undefined



nest9
12-01-2012, 07:39 PM
I have spent a couple of days not customizing a script I purchased to fit the needs of my website. I have some expereince with coding but not enough to figure out where a couple of my errors are coming from. For instance, when I debug a page on my website, it links me to the following error: 'GRIDW' is undefined The line in question, it highlighted below near the end of the page. Thanks for any feedback and help. I have two other (related/unlrealated) issues that I will post separately.
Thanks in advance for your time.



/*

['<?php echo $row_recZones1['name']; ?>', <?php echo $row_recZones1['x1']; ?>, <?php echo $row_recZones1['y1']; ?>,

<?php echo $row_recZones1['x2']+1; ?>, <?php echo $row_recZones1['y2']+1; ?> ,<?php echo $row_recZones1['price']; ?>,

<?php echo $row_recZones1['max_buy']; ?>],

*/



function Ovl(oArea, z) {

var area = 0;

if (z[1] < oArea.x2 && z[2] < oArea.y2 && oArea.x1 < z[3] && oArea.y1 < z[4]) {

area = Math.min(oArea.x2 - z[1], z[3] - oArea.x1, oArea.w, z[3] - z[1]) *

Math.min(z[4] - oArea.y1, oArea.y2 - z[2], oArea.h, z[4] - z[2]);

}



return area;

}



function FindOffendingZone(oArea, zones) {

for (i in zones) {

var z = zones[i];

var area = Ovl(oArea, z);

if (area > z[6]) {

return z[0] + " only accepts " + z[6] + " blocks maximum";

}

}



return false;

}



function CalcZonalPrices(oArea, zones, pxprice) {

var area = oArea.w * oArea.h;

var amt = 0;

var totalpixels = GRIDW*GRIDH;

for (i in zones) {

var z = zones[i];

var ova = Ovl(oArea, z);

amt += ova * totalpixels * z[5];

area -= ova;

}

amt += area * pxprice * totalpixels;

return amt.toFixed(2);

AndrewGSW
12-01-2012, 08:21 PM
Yes, GRIDW is undefined according to the code you have shown. You'll need to show the code that defines it and ensure that this code runs before the code fragment you have shown.

Also, enclose your code in CODE tags by clicking the hash sign # when creating your post: select the code and press #.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum