SHOW:
|
|
- or go back to the newest paste.
| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 3 | <head> | |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 5 | <title>Friba Weather Forecast Station</title> | |
| 6 | <link href="style.css" rel="stylesheet" type="text/css" /> | |
| 7 | <script type="text/javascript" src="jquery.min.js"></script> | |
| 8 | <script type="text/javascript" src="weather.js"></script> | |
| 9 | <script> | |
| 10 | function valemail(obj) | |
| 11 | {
| |
| 12 | var field = obj.value | |
| 13 | var id = obj.id; | |
| 14 | if(field){
| |
| 15 | var atpos = field.indexOf("@")
| |
| 16 | var dotpos = field.lastIndexOf(".")
| |
| 17 | var lastpos = field.length - 1 | |
| 18 | if(atpos < 2 || dotpos - atpos < 2 || lastpos-dotpos > 4 || lastpos-dotpos < 2 ){
| |
| 19 | return false | |
| 20 | } | |
| 21 | else{
| |
| 22 | return true | |
| 23 | } | |
| 24 | } | |
| 25 | } | |
| 26 | ||
| 27 | function submit_register(){// validation function for registration form
| |
| 28 | var flag = 0; | |
| 29 | if(document.getElementById('fname').value==""){
| |
| 30 | document.getElementById('fname').style.borderColor="#FF0000";
| |
| 31 | flag = 1; | |
| 32 | } | |
| 33 | else{
| |
| 34 | document.getElementById('fname').style.borderColor="";
| |
| 35 | } | |
| 36 | ||
| 37 | if(document.getElementById('lname').value==""){
| |
| 38 | document.getElementById('lname').style.borderColor="#FF0000";
| |
| 39 | flag = 1; | |
| 40 | } | |
| 41 | else{
| |
| 42 | document.getElementById('lname').style.borderColor="";
| |
| 43 | } | |
| 44 | ||
| 45 | if(document.getElementById('email').value==""){
| |
| 46 | document.getElementById('email').style.borderColor="#FF0000";
| |
| 47 | flag = 1; | |
| 48 | } | |
| 49 | else{
| |
| 50 | document.getElementById('email').style.borderColor="";
| |
| 51 | var obj = document.getElementById('email');
| |
| 52 | if(valemail(obj)==false){
| |
| 53 | document.getElementById('email').style.borderColor="#FF0000";
| |
| 54 | flag = 1; | |
| 55 | } | |
| 56 | else{
| |
| 57 | document.getElementById('email').style.borderColor="";
| |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | if(document.getElementById('mobile').value==""){
| |
| 62 | document.getElementById('mobile').style.borderColor="#FF0000";
| |
| 63 | flag = 1; | |
| 64 | } | |
| 65 | else{
| |
| 66 | document.getElementById('mobile').style.borderColor="";
| |
| 67 | } | |
| 68 | ||
| 69 | if(document.getElementById('password').value==""){
| |
| 70 | document.getElementById('password').style.borderColor="#FF0000";
| |
| 71 | flag = 1; | |
| 72 | } | |
| 73 | else{
| |
| 74 | document.getElementById('password').style.borderColor="";
| |
| 75 | } | |
| 76 | ||
| 77 | if(document.getElementById('cpassword').value==""){
| |
| 78 | document.getElementById('cpassword').style.borderColor="#FF0000";
| |
| 79 | flag = 1; | |
| 80 | } | |
| 81 | else{
| |
| 82 | document.getElementById('cpassword').style.borderColor="";
| |
| 83 | } | |
| 84 | ||
| 85 | if(document.getElementById('cpassword').value!=document.getElementById('password').value){
| |
| 86 | document.getElementById('cpassword').style.borderColor="#FF0000";
| |
| 87 | document.getElementById('password').style.borderColor="#FF0000";
| |
| 88 | flag = 1; | |
| 89 | } | |
| 90 | else{
| |
| 91 | document.getElementById('cpassword').style.borderColor="";
| |
| 92 | document.getElementById('cpassword').style.borderColor="";
| |
| 93 | } | |
| 94 | ||
| 95 | if(flag==0){
| |
| 96 | sessionStorage.login = document.getElementById('fname').value+" "+document.getElementById('lname').value;
| |
| 97 | document.register_form.reset(); | |
| 98 | $('#submit_status').html("Successfully register...");
| |
| 99 | ||
| 100 | ||
| 101 | $('body').append('<div class="login_details">Welcome, '+sessionStorage.login+'</div>');
| |
| 102 | ||
| 103 | } | |
| 104 | else{
| |
| 105 | $('#submit_status').html("Please check highlighted fields");
| |
| 106 | } | |
| 107 | ||
| 108 | } | |
| 109 | </script> | |
| 110 | </head> | |
| 111 | ||
| 112 | <body> | |
| 113 | ||
| 114 | <header> | |
| 115 | - | <div class="logo">Friba Shopping</div><!--title displays on the top left corner of the page--> |
| 115 | + | <div class="logo">Friba Weather Station</div><!--title displays on the top left corner of the page--> |
| 116 | - | <a href="basket.html"> |
| 116 | + | |
| 117 | - | <div class="shop"><!-- shopping basket box --> |
| 117 | + | |
| 118 | - | <img src="images/cart.png" id="img0"> |
| 118 | + | |
| 119 | - | <p>Item:<span id="item">0</span><br>Total:<span id="total">0</span></p> |
| 119 | + | |
| 120 | - | </div> |
| 120 | + | |
| 121 | - | </a> |
| 121 | + | |
| 122 | <li><a href="about.html">About us</a></li> | |
| 123 | <li><a href="register.html">Register</a></li> | |
| 124 | <li><a href="contact.html">Contact us</a></li> | |
| 125 | <li><a href="stock.html">Weather Forecast</a></li> | |
| 126 | <li><a href="login.html">Log In</a></li> | |
| 127 | ||
| 128 | </ul> | |
| 129 | </menu> | |
| 130 | ||
| 131 | <div class="page_content"><!-- the following codes is used to display the registration form on the content of the page--> | |
| 132 | <form action="index.html" method="get" id="register_form" name="register_form"> | |
| 133 | <table width="600" border="0" cellspacing="0" cellpadding="5"><!-- creates tables including rows and columns--> | |
| 134 | <tr> | |
| 135 | <td colspan="2"><h2>Register</h2></td> | |
| 136 | ||
| 137 | </tr> | |
| 138 | <tr> | |
| 139 | <td width="120">First name</td> | |
| 140 | <td><input type="text" name="fname" id="fname" /></td> | |
| 141 | </tr> | |
| 142 | <tr> | |
| 143 | <td>Last name</td> | |
| 144 | <td><input type="text" name="lname" id="lname" /></td> | |
| 145 | </tr> | |
| 146 | ||
| 147 | ||
| 148 | <tr> | |
| 149 | <td>Email</td> | |
| 150 | <td><input type="text" name="email" id="email" /></td> | |
| 151 | </tr> | |
| 152 | ||
| 153 | <tr> | |
| 154 | <td>Mobile</td> | |
| 155 | <td><input type="text" name="mobile" id="mobile" /></td> | |
| 156 | </tr> | |
| 157 | ||
| 158 | <tr> | |
| 159 | <td>Password</td> | |
| 160 | <td><input type="password" name="password" id="password" /></td> | |
| 161 | </tr> | |
| 162 | ||
| 163 | <tr> | |
| 164 | <td>Confirm Password</td> | |
| 165 | <td><input type="password" name="cpassword" id="cpassword" /></td> | |
| 166 | </tr> | |
| 167 | ||
| 168 | <tr> | |
| 169 | <td> </td><!-- line space--> | |
| 170 | <td><input type="button" name="button" id="button" value="Register" onclick="submit_register()" /> <span id="submit_status"></span></td> <!-- loads registration button--> | |
| 171 | </tr> | |
| 172 | ||
| 173 | </table><!-- end table--> | |
| 174 | </form><!-- end or close form--> | |
| 175 | ||
| 176 | </div> | |
| 177 | ||
| 178 | </div> | |
| 179 | </body> | |
| 180 | </html> |