Client Side Things
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Remember me

Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Add This Thread To:   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
Unread Codewalkers Forums Sponsor:
Old August 10th, 2013, 11:38 AM
philjt philjt is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
Join Date: Aug 2013
Posts: 2 philjt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 18 m 10 sec
Reputation Power: 0
Javascript - Javascript and the HTML progress tag

I'm trying to created a login page with complete with a progress tag to show how many more login attempts you are allowed. I'm adapting some Javascript that I found on another site that does a similar job each time an input box is filled ( to show your progress through a form. I can't get the linkage right. (I'm a javascript newbie) and would appreciate any help.

I'm posting all the code (HTML, CSS and javascript). This is just a demo page, so please excuse the garish colours!
     <!DOCTYPE HTML>       <html>       <head>       <meta charset="utf-8">               <title>Untitled Document</title>           <link href="css/access.css" rel="stylesheet" type="text/css">           <script src="_js/jquery-1.9.1.min.js"></script> 					      	  <script src="_js/modernizr.js"></script>       </head>              <body>              <div class = "accessbox" id="accessbox">                      <form method="post" accept-charset="UTF-8" action="#" class="login" id="login">  	<div class="field">                    <input id="username" required class="username" type="text" placeholder="Username"  name="username"/>      </div>      <div class="field">                <input id="pass" required class="pass" type="text" placeholder="Password" name="password"/>       </div>                       <input type="submit" name="submit" class="submit" id="submit">           <script src="js/progress_1.js"></script>               </form>	       </div>               <div class="progress-wrap">                 <progress max="100" value="0" id="progress"></progress>                 <div class="progress-message" id="progress-message">The Counter</div>                 <!--script src="js/progress.js"></script-->                        </div>                            </body>       </html>

	  *{@include box-sizing:border-box;}	 	   	  body{ 		  background-image:url(../images/progress_grunge_background.gif); 		  font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif; 		  font-size: 14px; 		  line-height: 1.4; 		  padding: 20px;} 	   	  .login { 		  padding:20px 2px 2px 2px; 		  padding-top:10px; 		  position:absolute; 		  background-color:#006; 		  width:200px; 		  height: 100px; 		  -webkit-border-radius: 1px; 		  -moz-border-radius: 1px; 		  border-radius: 5px; 		  border: 2px solid red; 		  left:190px; 		  top: 400px; } 		   	  input[type="text"], input[type="submit"] { 		  font-family:Tahoma, Geneva, sans-serif; 		  background-color:#99FFFF; 		  margin-top:2px; 		  margin-bottom:2px; 		  border:2px solid #999; 		  width:96%; } 		   	  input[type="submit"] { 		  margin-top:5px; 		  margin-left:40px; 		  width:50%; }	 		   	  progress { 		  width:200px; 		  height:20px;} 		   	  .progress-wrap { 		  top:550px; 		  left:165px; 		  position:relative; 		 /* text-align: center; */ 		  font-size: 10px; 		  color: red; 		  margin: 0 0 20px 0; 		  progress { 		  width: 100%;  		  margin: 0 0 5px 0;  		} 	  }

var numValid = 0;  $(document).ready( function (){   $("#login submit").on("click",function(){	   $("#login submit[required]").each(function() {     if (this.validity.valid) {         numValid++;     } 	 }); });  $("#login submit").click( function(){  var progress = $("#progress"),     progressMessage = $("#progress-message");  if (numValid == 0) {     progress.attr("value", "0");     progressMessage.text("The Counter"); } if (numValid == 1) {     progress.attr("value", "20");     progressMessage.text("1st"); } if (numValid == 2) {     progress.attr("value", "40");     progressMessage.text("2nd"); } if (numValid == 3) {     progress.attr("value", "60");     progressMessage.text("3rd"); } if (numValid == 4) {     progress.attr("value", "80");     progressMessage.text("4th"); } if (numValid == 5) {     progress.attr("value", "95");     progressMessage.text("5th"); }    });   });

Reply With Quote
Old November 20th, 2013, 09:34 AM
DavidMR's Avatar
DavidMR DavidMR is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
Join Date: Apr 2007
Location: Galway
Posts: 1,437 DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level)DavidMR User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Month 3 Days 20 h 56 m 48 sec
Reputation Power: 12
Could you post the code properly formatted and using tags?
When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car.

Reply With Quote

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Javascript - Javascript and the HTML progress tag

Developer Shed Advertisers and Affiliates

Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap