Saturday, November 6, 2010

Lesson 4: Is That Really Java?

I've encountered the same problem with Blogger for this lesson. I did the same thing as the email scrambler, by creating a dummy web page and adapting a file from my Dummies book.

I'm going to build my dad's travel agency website, so I thought form validation would be a super nifty thing to learn. Again, purple text identifies javascript elements. Here's my first attempt at it (minus the validation part, of course - but I can assure you it works on my dummy page!):

<head><script src='validate.js' type='text/javascript'/>
<style>
.msg_container { color: #FF0000 }
</style>
<title>Jenn's JavaLab</title>
</head>
<body>
<p>Please provide the following information:</p>
<form method=post" action="">

<label>Name: <input type="text" name="customer_name" id="customer_name" onblur="checkRequired( this, 'customer_name_msg' )"/>
</label><span class=".msg_container" id="customer_name_msg"> </span><br/>

<label>Email: <input type="text" name="email" id="email" onblur="checkEmail( this, 'email_msg' )"/></label><span class=".msg_container" id="email_msg"> </span><br/>

<label>Where you want to go: <select multiple="multiple" id="travel" onblur="checkRequired( this, 'travel_msg' )">
<option value="uk">United Kingdom</option>
<option value="ir">Ireland</option>
<option value="we">Western Europe</option>
<option value="rc">River Cruise</option>
</select></label><span class=".msg_container" id="travel_msg"> </span><br/>

<input type="submit" value="I want to travel!"/>

<input type="reset" />
</form>

No comments:

Post a Comment