logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-28-2010, 03:46 AM   #1
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default Explorer "Error on Page"

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?
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Old 01-28-2010, 05:31 AM   #2
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default

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.
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Old 01-28-2010, 05:52 AM   #3
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default

DOH, didn't declare a variable correctly This is what I have now:

Code:
<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.
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:43 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com