PDA

View Full Version : Explorer "Error on Page"


DWcourse
01-28-2010, 03:46 AM
I'm probably overlooking something obvious but on this page:

http://dominatedreamweaver.com/test3.php

The script to sum the fiels works everywhere but explorer. In explorer all I get is a message in the status bar, "Error on Page"

Any ideas?

DWcourse
01-28-2010, 05:31 AM
It's been too long since I paid any real attention to javascript, I found a couple ways to clean things up (not implemented yet) and I've discovered that "eval" is frowned upon but can't seem to find a way to get rid of it. But nothing yet to fix the explorer problem.

DWcourse
01-28-2010, 05:52 AM
DOH, didn't declare a variable correctly This is what I have now:

<script type="text/javascript">
function calculate(a,b,c) {
val = 0;
for( i = a; i < (b+1); i++ )
{
var item = eval('document.form1.q'+ i);
for( j = 0; j < item.length; j++ )
{
xval=0;
if( item[j].checked === true )
{
xval = eval(item[j].value);
break; // stop searching as soon as one is found
}
}
val=val + xval;
}
fld = eval('document.form1.sum' + c);
fld.value = val;
}
</script>

Is there anyway to get rid of the eval statements (or are they really a problem?)

I have a form with checkboxes (q1, q2, etc) and I'm trying to grab and sum the values for each.