Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 June 3rd, 2004, 09:27 AM
Authorized User
 
Join Date: Sep 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default more book code issues

chapter 6 page 208
the following code does not reset the radCPUSpeed radio button as described on page 212. If option 1GZh is selected.
Any help would be appreciated. Here is the code from the book

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language=javascript>
var radCpuSpeedIndex = 0;

function radCPUSpeed_onclick(radIndex)

{
var returnValue = true;

    if (radIndex == 1) //if index is 1 we are out ot that item and return false which
    { //cancels the action
    returnValue = false;
    alert("We are out of that one ");
    document.form1.radCPUSpeed[radCpuSpeedIndex].checked = true; //reset

    }
    else
    {
    radCpuSpeedIndex = radIndex;
    alert(radCpuSpeedIndex);
    }
return returnValue;
}

function butCheck_onclick()
{
var controlIndex;
var element;
var numberOfControls = document.form1.length;
var compSpec = "Your chosen processor speed is ";
compSpec = compSpec + document.form1.radCPUSpeed[radCpuSpeedIndex].value;
compSpec = compSpec + "\nWith the following additional components\n";
for(controlIndex = 0; controlIndex < numberOfControls; controlIndex++)
    {
    element = document.form1[controlIndex]
    if(element.type == "checkbox")
        {
        if(element.checked == true)
            {
            compSpec = compSpec + element.value + "\n";
            }
        }
    }
alert(compSpec);
}

</script>
</head>
<body>
<form name=form1>
<P>
Tick all the components you want included in your computer<BR><BR>
<table>
<tr><TD>DVD</td><td><input type=checkbox name=chkDVD value="DVD"></td>
</tr>
<tr><TD>CD</td><td><input type=checkbox name=chkCD value="CD"></td>
</tr>
<tr><TD>Zip Drive</td><td><input type=checkbox name=chkZip value="ZIP"></td>
</tr>
</table>
<P>
Select the processor speed you require<P>
<table>
<tr>
<td><input type=radio name=radCPUSpeed checked
onclick="return radCPUSpeed_onclick(0)" value="800 MHz"></td>
<td>800MZh</td>
<td><input type=radio name=radCPUSpeed
onclick="return radCPUSpeed_onclick(1)" value="1 GHz"></td>
<td>1 GHz</td>
<td><input type=radio name=radCPUSpeed
onclick="return radCPUSpeed_onclick(2)" value="1.5 GHz"></td>
<td>1.5 GHz</td>
</tr></table>
</TABLE>
<P>

<P>
<input type=button value="Check form" name=butCheck onclick="return butCheck_onclick()">;
</form>
</body>
</html>


 
Old June 3rd, 2004, 09:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Default

We are sending this issue to our programming specialists for review.

XUMUSKIEFAN
Wrox Moderator





Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
Book Issues and suggestions codewife55 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 September 23rd, 2006 10:49 PM
where is c# code for book? djricochet BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 April 10th, 2006 09:11 AM
book code skicrud Javascript How-To 3 June 28th, 2004 05:11 PM
Where is the code for the book skywen Forum and Wrox.com Feedback 2 January 7th, 2004 03:34 AM





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