Wrox Programmer Forums
|
BOOK: Beginning HTML, XHTML, CSS, and JavaScript
This is the forum to discuss the Wrox book Beginning HTML, XHTML, CSS, and JavaScript by Jon Duckett; ISBN: 978-0-470-54070-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning HTML, XHTML, CSS, and 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 May 21st, 2014, 08:52 AM
Registered User
 
Join Date: Feb 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default What's wrong with this code?

Code:
<!doctype html>

<html>
	<head>
		<title>Switch Statement</title>
		<script type="text/javascript">
			function checkAnimal()
			{
				Switch (document.frmAnimal.txtAnimal.value)
				{
					case "rabbit":
						alert("Watch out, it's Elmer Fudd!")
						break;
					case "coyote":
						alert("No match for the road runner - meep meep!")
						break;
					case "mouse":
						alert("Watch out Jerry, here comes Tom!")
						break;
					default:
						alert("Are you sure you picked an animal from a cartoon?");
				}
			}
		</script>
	</head>
	<body>
		<p>
			Enter the name of your favorite type of animal that stars in a cartoon : 
		</p>
		<form name="frmAnimal">
			<input type="text" name="txtAnimal" /><br />
			<input type="button" value="Check Animal" onclick="checkAnimal()" />
		</form>
		<p>Note that rabbit, coyote, and mouse will all get different responses.</p>
	</body>
</html>





Similar Threads
Thread Thread Starter Forum Replies Last Post
what could be wrong with this code? Zion_Rebecca Beginning PHP 1 August 23rd, 2011 09:47 AM
What's wrong with this code jack123 SQL Server 2000 4 July 11th, 2007 12:09 PM
What's wrong with this code? AlDugan XSLT 3 May 19th, 2006 12:06 PM
Can anyone tell me what's wrong with this code? hobgoblin BOOK: Beginning ASP 3.0 0 March 3rd, 2005 01:47 PM
what's wrong with this code? miguel.ossa ASP.NET 1.0 and 1.1 Basics 2 January 21st, 2004 11:33 AM





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