DragonTooth™



Welcome To DragonTooth (GameDEV). Our Administrators: Emptrix, Amethyst, Shizuko~Conan, Yamino. To Contact Us, e-mail: Dragon_Tooth@live.com.
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Welcome to DragonToothDEV Forum. We are currently not taking anymore new users, however we will accept users that has Friend's Recommendation. Members who's friends are joining please pm one of the Administrators the username of your friend's newly created account to get it activated.

Share | 
 

 (Requested) Check for Items code - HTML & Javascript

Go down 
AuthorMessage
Emptrix
Staff Administrator
avatar

Posts : 1218
Points : 1916
Reputation : 13
Join date : 2009-05-09
Age : 27
Location : The World That Never Was

PostSubject: (Requested) Check for Items code - HTML & Javascript   Tue Nov 16, 2010 12:12 pm

As requested by Burma, here: Very Happy

Code:

<!Author: Emptrix>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">

<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 14 February 2006), see www.w3.org">
    <title>Practice Exercise 6</title>
      <script type="text/javascript">
      function check() {
         var pc = document.product_form.p_code.value;
         var pd = document.product_form.p_desc.value;
         var p = document.product_form.price_txt.value;
         
            if (pc == "") {
               alert("Please enter a product code.");
               document.product_form.p_code.focus();
            } else if (pc.length != 6) {
               alert("Your product code must be 6 digits.");
               document.product_form.p_code.focus();
            } else if (isNaN(pc)) {
               alert("Product code must be in numbers only.");
            } else if (pd == "") {
               alert("Please enter a product desc.");
               document.product_form.p_desc.focus();
            } else if (p < 20 || p > 40) {
               alert("Price range is out of bound. Please enter a price within $20 to $40.");
               document.product_form.p.focus();               
            } else if (document.product_form.shirt_category.options[0].selected) {
               alert("Please select a shirt category.");
            } else {
               var request = confirm("Your Shirt has been successfully sent to us!");
                  if (request == false) {
                     alert("Submit was canceled");
                  } else {
                     window.open("confirmpage.html");
                  }
            }
         }
      </script>
   </head>
  <body>
   <form name="product_form" allow="" method="post">
      <table>
         <tr>
            <td>Product Code: </td>
            <td><input type="text" name="p_code" value="" onBlur="check()" /></td>
         </tr>
         <tr>
            <td>Product Desc: </td>
            <td><input type="text" name="p_desc" value="" onBlur="check()" /></td>
         </tr>
         <tr>
            <td>Price: </td>
            <td><input type="text" name="price_txt" value="" onBlur="check()" /></td>
         </tr>
         <tr>
            <td>Shirt Category: </td>
            <td>
               <select name="shirt_category">
                  <option value="">Select Here</option>
                  <option value="round neck">Round Neck</option>
                  <option value="v neck">V Neck</option>
               </select>
            </td>
         </tr>
         <tr>
            <td></td>
            <td><input type="button" name="button" value="Sent Your Shirt!" onClick="check()" /></td>
         </tr>
      </table>
   </form>
  </body>
</html>


_________________
Back to top Go down
View user profile http://emptrix.tk
 
(Requested) Check for Items code - HTML & Javascript
Back to top 
Page 1 of 1
 Similar topics
-
» Custom Pagination
» How to edit the banner (fixed)
» Urgent-how can i select and click on items present in combo box/drop down list box
» Test javascript Calendar
» Javascript Array

Permissions in this forum:You cannot reply to topics in this forum
DragonTooth™ :: Help & Support :: Help & Requests-
Jump to: