Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 30th, 2003, 07:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default syntax error

Hi there

I'm getting a syntax error with this code right at the bottom of the script where it's marked in red but I can't seem to see if myself. Any help would be greatly appreciated.

<script language="javascript" type="text/javascript">

function toggleCheck(thisField) {
checkSet = eval("document.frm_bk."+ thisField)
checkSet.checked = !(checkSet.checked)
    }
function toggleRadio(thisField, thisValue) {
radioSet = eval("document.frm_bk."+ thisField)
    }

for (i=0;i<radioSet.length;i++) {
    if (radioSet[i].value ==
    thisValue)
    radioSet[i].checked = true
    }
}
Thanks

Adam
 
Old October 30th, 2003, 08:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

You have one more closing bracket than opening.

I think the one you should remove is the one following the line
Code:
radioSet = eval("document.frm_bk."+ thisField)
 
Old October 30th, 2003, 08:13 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

As a side issue using eval is very poor practice. It creates a new script engine each time it is used which can slow execution times considerably. Instead of:
Code:
checkSet = eval("document.frm_bk."+ thisField)
try

Code:
checkSet = document.frm_bk[thisField];


--

Joe
 
Old October 30th, 2003, 10:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks guys - works a treat with your suggestions!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
VB Error: Syntax Error or Access Violation codehappy VB How-To 7 October 3rd, 2007 05:41 PM
Compile error: Syntax error: & Else without HELP Corey VB How-To 2 April 21st, 2006 03:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.