JavaScript - Creating A Registration Nag-counter
Anybody help to start out this code:
Create a "nag" counter that tells users to register. Save the counter in a cookie and display a message reminding users to register every fifth time they visit your site. There are four other parts to this task that I know how to do. I cannot find anything close to this in our book referencing a nag-counter or something similar to it. Thanks, in advance. Regards, AO5431 Similar TutorialsSo I'm really new to javascript and html. The most advanced thing Ive made was probably a Russian rullete simulator, but I need help with this one program Im working on. So if anyone could tell me whats wrong with this, I would appreciate it! <html> <head> <font size="4">Click the button below as many times as you can</font> <br> <script type="text/javascript"> var clicks=0 function count() { clicks=clicks+1; } </script> </head> <body> <input type="button" value="Click Me" OnClick="count()"> <br> <p>Clicks: <script type="text/javascript"> document.write(clicks); </script></p> </body> </html> I have the following codes and it seems to work well but when exiting the site and re-entering it resets the values to 0 again. I am not sure how to proceed with this, been considering cookies but what if the user clears there cookies, I then looked at PHP but not understanding that to well at this stage. Javascript Code: // Function to count clicks on links var clicks1 = 0; var clicks2 = 0; var clicks3 = 0; var clicks4 = 0; function link1(){ document.getElementById('clicked1').value = ++clicks1; } function link2(){ document.getElementById('clicked2').value = ++clicks2; } function link3(){ document.getElementById('clicked3').value = ++clicks3; } function link4(){ document.getElementById('clicked4').value = ++clicks4; } HTML Code: Code: <tr valign="middle" align="center"><td colspan="1"><a target="_blank" href="http://mistiquestormelectronics.webs.com/" onclick="link1()"><img src="site_graphics/reinet.jpg" alt="Mistique Storm" width="120" height="90" /></a></td> <td colspan="2" align="left"><p>For all your Electronic equipment needs.</p></td> <td colspan="1" width="8%"><input id="clicked1" style="color: #000000; font-weight:bold; border-style: none; font-family: arial; background-color: #00FF00; text-align: center;" readonly="readonly" size="10" onfocus="this.blur();" value="0" ></td></tr> Any ideas, suggestions. Please Help? Hi All, could you please help me. A have a little program and i need to count somehow how many times a while loop is ran. how could i do that? Thanks for your help I need help with a counter that will either display a different image everyweek or change text every week. The scenario is a counter will be on the top right corner of the page, and every week the number will change from 1 to 2 to 3... to 52... I searched on this forum for answers, i found some similar for a different day counter. Any help would be great! Hey Everyone, I'm working on a counter. I have two images - each with their own click count. Right now each time the page loads the counter goes back to zero. I would assume I need some kind of server side coding. Any recommendations? Here's what I have so far. <html> <head> <script type="text/javascript"> var counter = 0; function increaseloveit() { counter += 1; document.getElementById('loveit').value = counter; } var counter = 0; function increasehateit() { counter += 1; document.getElementById('hateit').value = counter; } </script> </head> <body> <form> <a href="#" onclick="javascript:increaseloveit();"><input type="button" value="Love It!" name="loveit" onclick="" /></a><input id="loveit" value="0" size="2" /></form> <form> <a href="#" onclick="javascript:increasehateit();"><input type="button" value="Hate It!" name="hateit" onclick="" /></a><input id="hateit" value="0" size="2" /></form> </body> </html> I am trying to use the Jquery loader (this ends when page loads) but I want it to load how many seconds the page took. (using the clean preloader) $( "#progressbar" ).progressbar({ value: setTimeout("seconds++",10000000) }); but getting "anything" to work in the "VALUE" has been such a pain. any one that knows how to create a timer to add to the value so that preload will keep loading? or if even possible? thanks This is a bit of a lazy post but hey, Currently i have an awful lot of checks that run the same check on different variables. Simple Request... Can anyone see an obvious way (which i have clearly missed) to clean up and reduce the amount of code in the below. Code: <? // required code for every page. require($_SERVER['DOCUMENT_ROOT'] . '/scripts/required.php'); // end of required code for every page if(isset($_POST['sbmt'])) { // get variables $new_user = trim($_POST['user']); $new_pass = $_POST['newpass']; $con_pass = $_POST['conpass']; $new_fname = trim($_POST['fname']); $new_email = $_POST['email']; $con_email = $_POST['conemail']; $agree = $_POST['agree']; $level = $_POST['level']; $ip = @$_SERVER['REMOTE_ADDR']; // add slashes $new_user = addslashes($new_user); // encrypt $new_pass_e = hash('ripemd160',$new_pass); $con_pass_e = hash('ripemd160',$con_pass); // check username exists // connect to database $con = mysql_connect(DBHOST, DBUSER, DBPASS); if(!$con) { die('Could not connect: ' . mysql_error());} mysql_select_db(DBNAME, $con); // get row for user $result = mysql_query("SELECT * FROM tUsers WHERE username='$new_user'"); $row = mysql_fetch_array($result); // kill connection mysql_close($con); // check username exists if($row['username']!=null) $user_error = 'Username already in use.<br />'; else $user_error = null; // check email is available // connect to database $con = mysql_connect(DBHOST, DBUSER, DBPASS); if(!$con) { die('Could not connect: ' . mysql_error());} mysql_select_db(DBNAME, $con); // get row for user $result = mysql_query("SELECT * FROM tUsers WHERE email='$new_email'"); $row = mysql_fetch_array($result); // kill connection mysql_close($con); // check email is available if($row['email']!=null) $email_error = 'Email already in use.<br />'; else $email_error = null; // check lengths if(strlen($new_user)<3) $user_len_error = 'Username must be at least 3 characters<br />'; else $user_len_error = null; if(strlen($new_pass)<6) $pass_len_error = 'Password must be at least 6 characters<br />'; else $pass_len_error = null; if(strlen($new_fname)<6) $fname_len_error = 'Your name must be at least 6 characters<br />'; else $fname_len_error = null; // preg matches if(!preg_match('/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/', $new_email)) $email_preg_error = "Email is not valid.<br />"; else $email_preg_error = null; if(!preg_match('/[a-zA-Z]+\s+[a-zA-Z]+/',$new_fname)) $fname_preg_error = 'Name must containt at least one space.<br />'; else $fname_preg_error = null; // check matches if($new_pass != $con_pass) $pass_match_error = 'The passwords do not match.<br />'; else $pass_match_error = null; if($new_email != $con_email) $email_match_error = 'The emails do not match.<br />'; else $email_match_error = null; // build error list $errorlist = $user_error; $errorlist .= $email_error; $errorlist .= $user_len_error; $errorlist .= $pass_len_error; $errorlist .= $fname_len_error; $errorlist .= $email_preg_error; $errorlist .= $fname_preg_error; $errorlist .= $pass_match_error; $errorlist .= $email_match_error; // set expirey to a month $expire = 0; // set error list cookie setcookie('errorlist',$errorlist,$expire,'/'); // reload register.php header('Location:' . URL . '/register.php'); } ?> The required file is just a series of defines for items like the dbhost, dbusername, dbname, url etc etc. Cheers p.s. I want to add an if statement for if $errorlist=null then do bla else bla... in order for errorlist to be null... do i actually need to define the individual error messages as null. That could get rid of a lot of: else $<error name>=null; I'm pretty sure I can but i'd like to check first. Sup gents Can someone please tell me whats wrong with this code? The user is supposed to input a pass and script needs to check the array to see if such a pass exists in the array and confirm. Im building a sign in system for my website and this is the first step. Dont mind the global values in the beginning i plan to use them later while applying restrictions. Code: <html> <head> <script type ="text/JavaScript"> var counter = 0; var trial = 0; var base = 0; var choice = 0; var array2[] = {"1000", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009"}; var searchKey = searchform.inputVal.value; function pass() { for (var i =0; i < array2.length; i++) { if (array2[i] == searchkey ) searchform.result.value = "correct password"; } else return -1; } </script> </head> <body> <form name = "searchform" action = ""> <p>Enter password<br /> <input name = "inputVal"/> <input name = "search" type = "button" value = "Search" onclick = "pass()" /><br /></p> <p>Result<br /> <input name = "result" type = "text" size = "30" /></p> </form> </body> </html> I have the following code but it is not even showing up in the browser. I am very new to JS and very willing to learn. The code was originally found on this site and I have tweaked it and now it doesn't work...Any assistance would be much appreciated. <script type = "text/javascript"> var seconds; var clockId; function startClock(seconds){ timeInSeconds = parseInt(seconds); clockId = setInterval("tick()",1000); } function runClock() { var seconds = timeInSeconds; if (seconds > 60) { // stop at "" seconds alert ("Your time is up!"); clearInterval(clockId); // stop counting return false; } else { timeInSecs++; } var hours= Math.floor(seconds/3600); seconds %= 3600; var mins = Math.floor(seconds/60); secs %= 60; var result = ((hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secondss < 10) ? "0" : "" ) + seconds; document.getElementById("countdown").innerHTML = result; } startClock(0); // start count at 0 seconds </script> <span id="countdown" style="font-weight: bold;"></span> Hey Everyone, I'm trying to set up two different buttons that count their own individual clicks. So far I have everything except where one button leaves off, the other picks up. So if I click the left one three times it shows the number 3, and then if I click the button next to it, that button picks up at 4. I want each button to have its own count. Any ideas? Here's what I have so far. <html> <head> <script type="text/javascript"> var counter = 0; function increaseloveit() { counter += 1; document.getElementById('loveit').value = counter; } var counter = 0; function increasehateit() { counter += 1; document.getElementById('hateit').value = counter; } </script> </head> <body> <form> <a href="#" onclick="javascript:increaseloveit();"><input type="button" value="Love It!" name="loveit" onclick="" /></a><input id="loveit" value="0" size="2" /></form> <form> <a href="#" onclick="javascript:increasehateit();"><input type="button" value="Hate It!" name="hateit" onclick="" /></a><input id="hateit" value="0" size="2" /></form> </body> </html> H, I'm trying to create an sms form. but I want the users to be able to monitor the characters and sms number as they type...taking 160 characters to be 1 page. pls I'll need help with coding this form to display characters left in 'ch_count' box and number of pages in the 'pages' box while typing in the 'message' textarea....hope it's clear enough...thanks Code: <p> <textarea name="message" cols="" rows="" id="message"></textarea> </p> <p> <input name="ch_count" type="text" id="ch_count" size="8" /> characters left <input name="pages" type="text" id="pages" size="8" /> pages </p> Hi Guys, Hope you can help. My sister has made a web site with a web counter and want to get the counter up by a few hundered. She cannot alter the number manually. Is there a script i can use to get the web counter up by a few hundred? So in other words a web page with java on so it gones on to her site (adds a count) leave it Or refresh it then reload it. Hope i have made my self Clear. thanx, Or even i culd run a web page which loads the page, closes it and load it again. Thanx. Lusa.. Hi, I have added a time counter in below code. This is used to track the total time of a project. If a person is going on break, then they will apply the break that stops the time counter. However, once they come back from break and end the break, then time is counting at double speed (two seconds instead at one second). Is there any mistake that I done that made the time counter to increment by 2 seconds instead of 1 second after break. Any help please.... Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>Strategy One - Tracker</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]--> <!-- Script for Current time in text box --> <script type="text/javascript"> function GetDate() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('start_time').value = curHour + ":" + curMin; var row = document.getElementById("end1_time"); var row1 = document.getElementById("start1_time"); row.style.display = 'none'; row1.style.display = 'none'; } </script> <!-- End of Script for Current time in text box --> <!-- Script for Current time in text box --> <script type="text/javascript"> function GetDate1() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('end_time').value = curHour + ":" + curMin; var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } </script> <script type="text/javascript"> function GetDate2() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('break_time_out').value = curHour + ":" + curMin ; var row = document.getElementById("end2_time"); row.style.display = ''; } </script> <script type="text/javascript"> function GetDate3() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('break_time_in').value = curHour + ":" + curMin ; } </script> <script type="text/javascript"> function tout1() { var temp= document.tracker.start_time.value; if(temp.length>0) { var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); row1.style.display = 'none'; row2.style.display = 'none'; } else { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; } } function tout2() { var temp= document.tracker.start_time.value; if(temp.length>0) { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } else { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = ''; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } } </script> <script type="text/javascript"> var seconds = 0; var minutes = 0; var hours = 0; function zeroPad(time) { var numZeropad = time + ''; while(numZeropad.length < 2) { numZeropad = "0" + numZeropad; } return numZeropad; } function countSecs() { var j=document.tracker.hide.value; if(j=="yes") { seconds++; if (seconds > 59) { minutes++; seconds = 0; } if (minutes > 59) { hours++ minutes = 0; } document.tracker.time_utilization.value = zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds); } else {} } function startTimer() { action = window.setInterval(countSecs,1000); } function s() { document.tracker.hide.value ="yes"; startTimer(); } function p() { document.tracker.hide.value ="no"; } </script> </head> <body> <form name="tracker" method="post" action="processor.php" onsubmit="return formCheck(this);"> <label class="formFieldQuestion">Start Time *</label><input readonly class=mainForm type=text name=start_time id=start_time size='30' value=''> <input type="button" id="start1_time" style="width: 100px" Value="Start Time" onClick="javascript:GetDate();s();"></li> <label class="formFieldQuestion">End Time *</label><input readonly class=mainForm type=text name=end_time id=end_time size='30' value='' > <input type="button" id="end1_time" style="width: 100px" Value="End Time" onClick="javascript:GetDate1(); p();" style='display: none'></li> <input type="hidden" name="hide" /> <label class="formFieldQuestion">Break Time Out </label><input class=mainForm readonly type=text name=break_time_out id=break_time_out size='30' value='' > <input type="button" id="start2_time" style="width: 100px" Value="Start Time" onClick="javascript:GetDate2();tout1();p();"></li> <label class="formFieldQuestion">Break Time In </label><input class=mainForm readonly type=text name=break_time_in id=break_time_in size='30' value=''> <input type="button" id="end2_time" style="width: 100px" Value="End Time" onClick="javascript:GetDate3(); tout2();s();" style='display: none'></li> <label class="formFieldQuestion">Time Utilization</label><input class=mainForm type=text name=time_utilization id=time_utilization size='30' value='' readonly></li> <br /> <br /> <input id="saveForm" class="mainForm" type="submit" value="Submit" style="width : 100px"/> </form> </body> </html> Hello, i got a problem with form like this: https://www2.giocarena.com/it-IT/Register/Start.aspx It's possible to set the field Cod Referent????? I've tried with this: <form name="aspForm" method="post" action="https://www2.giocarena.com/it-IT/Register/Start.aspx" target="_blank"> <input type="hidden" name="ctl00$cphBaseContainer$ctl00$txt_code" value="44411122224322445"></input> <button type="submit"> Nome </button> </form> Thank you!Thank you, thank you! <?php require('connect.php'); if($_POST['reg1']=="Register") { $stmt1="insert into regtable(fname,lname,c_addr,p_addr,phno,email,dob,gender,qual,wexp,usertype,btype,uname,pwd) values('$name1','$name2','$add1','$add2','$phno1','$email1','$dob1','$gend1','$qual1','$wexp1','$uty pe','$batch1','$user','$upwd')"; $res1=mysql_query($stmt1,$con);} ?> <html> <head> <script type="text/javascript"> function validate() { f=0; if(document.getElementById('fname').value=="") { document.frm1.fname.style.border='1px solid red'; //document.frm1.fname.style.background='#FFFFCC'; document.frm1.fname.focus(); document.getElementById('d_fname').style.visibility="visible"; document.getElementById('d_fname').innerHTML="Enter First Name"; } else { f++; } if(document.getElementById('lname').value=="") { document.frm1.lname.style.border='1px solid red'; document.frm1.lname.focus(); document.getElementById('d_lname').style.visibility="visible"; document.getElementById('d_lname').innerHTML="Enter Last Name"; } else { f++; } if(document.getElementById('addr1').value=="") { document.frm1.addr1.style.border='1px solid red'; document.frm1.addr1.focus(); document.getElementById('d_cadd').style.visibility="visible"; document.getElementById('d_cadd').innerHTML="Enter Contact Address"; } else { f++; } if(document.getElementById('pno').value=="") {document.frm1.pno.style.border='1px solid red'; document.frm1.pno.focus(); document.getElementById('d_pno').style.visibility="visible"; document.getElementById('d_pno').innerHTML="Enter Phone Number"; } else { f++; } if(document.getElementById('emid').value=="") {document.frm1.emid.style.border='1px solid red'; document.frm1.emid.focus(); document.getElementById('d_emid').style.visibility="visible"; document.getElementById('d_emid').innerHTML="Enter Email Id"; } else {f++; } if(document.getElementById('day').value=="0") { document.frm1.day.style.border='1px solid red'; document.getElementById('d_dob').style.visibility="visible"; document.getElementById('d_dob').innerHTML="Invalid Date"; } else { f++; } if(document.getElementById('month').value=="0") { document.frm1.month.style.border='1px solid red'; document.getElementById('d_dob').style.visibility="visible"; document.getElementById('d_dob').innerHTML="Invalid Date"; } else { f++; } if(document.getElementById('year').value=="0") { document.frm1.year.style.border='1px solid red'; document.getElementById('d_dob').style.visibility="visible"; document.getElementById('d_dob').innerHTML="Invalid Date"; } else {f++; } if((document.getElementById("gender1").checked!=true) && (document.getElementById("gender2").checked!=true)) { //document.frm1.gender.style.border='1px solid red'; document.getElementById('d_gender').style.visibility="visible"; document.getElementById('d_gender').innerHTML="Select Gender"; } else { f++; } if((document.getElementById("qual1").checked!=true) && (document.getElementById("qual2").checked!=true) && (document.getElementById("qual3").checked!=true) && (document.getElementById("qual4").checked!=true)) { //document.frm1.gender.style.border='1px solid red'; document.getElementById('d_qual').style.visibility="visible"; document.getElementById('d_qual').innerHTML="Select Qualification"; } else {f++; } if(document.getElementById('wexp').value=="") { document.frm1.wexp.style.border='1px solid red'; //document.frm1.emid.focus(); document.getElementById('d_wexp').style.visibility="visible"; document.getElementById('d_wexp').innerHTML="Select Work Experience"; } else {f++;} if(document.getElementById('utype').value=="") { document.frm1.utype.style.border='1px solid red'; document.getElementById('d_utype').style.visibility="visible"; document.getElementById('d_utype').innerHTML="Select Usertype"; } else {f++; } if(document.getElementById('btype').value=="") { document.frm1.btype.style.border='1px solid red'; //document.frm1.emid.focus(); document.getElementById('d_btype').style.visibility="visible"; document.getElementById('d_btype').innerHTML="Select Batch"; } else {f++; } if(document.getElementById('uname').value=="") { document.frm1.uname.style.border='1px solid red'; document.frm1.uname.focus(); document.getElementById('d_uname').style.visibility="visible"; document.getElementById('d_uname').innerHTML="Enter Username"; } else {f++; } if(document.getElementById('pwd').value=="") { document.frm1.pwd.style.border='1px solid red'; document.frm1.pwd.focus(); document.getElementById('d_pwd').style.visibility="visible"; document.getElementById('d_pwd').innerHTML="Enter Password"; } else {f++; } if(document.getElementById('rpwd').value=="") { document.frm1.rpwd.style.border='1px solid red'; document.frm1.rpwd.focus(); document.getElementById('d_rpwd').style.visibility="visible"; document.getElementById('d_rpwd').innerHTML="Retype Password"; } else { f++; } if(f==15) {return true;} else { return false;} } /*function nameval() { var fnm=document.getElementById('fname').value; var pat=/\d\g; if(fnm.match(pat)) { alert("Only characters are allowed"); } }*/ function phonval() { var ph=document.getElementById("pno").value; var pat=/\s/g; var ex=/\D/g; str=""; if(ph.match(ex)) { // alert ("Invalid Phone"); str=str+ "Phone number should be digits"; document.getElementById('pno').value=""; } else if(ph.length!=10) { str=str+"Phone number should be of 10 digits" //alert("Phone number should be of 10 digits"); } /*else if(ph.match(pat)) { str=str+"Phone number cannot have blank spaces"; //alert("Phone number cannot have blank spaces"); } */ if(str.length!=0) { alert(str);} } function emailval() { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var address = document.getElementById('emid').value; if(reg.test(address) == false) { alert('Invalid Email Address'); return false; } } </script> </head> <body id="www-url-cz" onload="inactive()"> <h2><img src="design/icon-registration.png" height="70px" \>Registration Form</h2> <form name="frm1" method="post"> <table style="padding-top:50px;"> <tr> <th align="left">First Name</th> <td><input type="text" name="fname" id="fname" size="27" class="border"></td> <td class='err'><div id="d_fname"></div></td> </tr> <tr></tr> <tr> <th align="left">Last Name</th> <td><input type="text" name="lname" id="lname" size="27" class="border"></td> <td class='err'><div id="d_lname"></div></td> </tr> <tr></tr> <tr> <th align="left">Contact Address</th> <td><textarea rows="5" cols="20" name="addr1" id="addr1" class="border"></textarea></td> <td class="err"><div id="d_cadd"></div></td> </tr> <tr></tr> <tr> <th align="left">Permanent Address</th> <td><textarea rows="5" cols="20" name="addr2" id="addr2" class="border"></textarea></td> <td class='err'><div id="d_padd"></div></td> </tr> <tr></tr> <tr> <th align="left">Phone Number</th> <td><input type="text" name="pno" id="pno" size="27" class="border" onblur="phonval()"></td> <td class='err'><div id="d_pno"></div></td> </tr> <tr></tr> <tr> <th align="left">Email id</th> <td><input type="text" name="emid" id="emid" size="27" class="border" onblur="return emailval()"></td> <td class='err'><div id="d_emid"></div></td> </tr> <tr></tr> <tr> <th align="left">Date of Birth</th> <td colspan="3"> <select name="day" id="day" class="border" onchange="dat_day()"> <option value="0">Day</option> <script type="text/javascript"> for(i=1;i<=31;i++) { document.write("<option value="+i+">"+i+"</option>"); } </script> </select> <select name="month" id="month" class="border" onchange="dat_month()"> <option value="0">Month</option> <option value="1">Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> <option value="4">Apr</option> <option value="5">May</option> <option value="6">June</option> <option value="7">Jul</option> <option value="8">Aug</option> <option value="9">Sep</option> <option value="10">Oct</option> <option value="11">Nov</option> <option value="12">Dec</option> </select> <select name="year" id="year" class="border" onchange="dat_year()"> <option value="0">Year</option> <script type="text/javascript"> for(i=1975;i<=1996;i++) { document.write("<option value="+i+">"+i+"</option>") } </script> </select><div class="err" id="d_dob"></div> </td> <!--<td class="err"><div id="d_dob"></div></td>--> </tr> <tr></tr> <!--<tr> <th align="left">Age</th> <td><input type="text" name="age id="age" size="27" class="border"></td> </tr>--> <tr> <th align="left">Gender</th> <td colspan="3"> Male<input type="radio" value="male" name="gender" id="gender1"> Female<input type="radio" value="female" name="gender" id="gender2"> <div class="err" id="d_gender"></div> </td> <!--<td class='err'><div id="d_gender"></div></td>--> </tr> <tr></tr> <tr> <th align="left">Qualification</th> <td colspan="5"> SSLC<input type="radio" value="sslc" name="qual" id="qual1"> Plus Two<input type="radio" value="plus_two" name="qual" id="qual2"> Degree<input type="radio" value="degree" name="qual" id="qual3"> PG<input type="radio" value="pg" name="qual" id="qual4"> <div class="err" id="d_qual"></div> </td> <!--<td class='err'><div id="d_qual"></div></td>--> </tr> <tr></tr> <tr> <th align="left">Work Experience(in years)</th> <td colspan="2"><select name="wexp" id="wexp" class="border"> <option value=''>Select One</option> <script type="text/javascript"> for(var i=0;i<=15;i++) { document.write("<option value="+i+">"+i+"</option>"); } </script> <option>More than 15 years</option> </select> <div id="d_wexp" class="err"></div> </td> <!--<td class='err'><div id="d_wexp"></div></td>--> </tr> <tr></tr> <tr> <th align="left">User Type</th> <td><select name="utype" id="utype" class="border"> <option value=''>Select One</option> <option value='admin'>Administrator</option> <option value='trainer'>Trainer</option> <option value='trainee'>Trainee</option> </select> </td> <td class='err'><div id="d_utype"></div></td> </tr> <tr></tr> <tr> <th align="left">Batch Type</th> <td><select multiple="multiple" size="0" name="btype" id="btype" class="border"> <option value=''>Select One</option> <?php while($row=mysql_fetch_array($result)) { ?> <option value="<?php echo $row['batchtypeid']?>"><?php echo $row['batchtype'] ?></option> <?php } ?> </select> </td> <td class='err'><div id="d_btype"></div></td> </tr> <tr></tr> <!-- <tr> <th align="left">Batch Code</th> <td> <select multiple="multiple" size="0" name="bcode" id="bcode" class="border">--> <!--<option value="">Select One</option>--> <!--</select> </td> <td class='err'><div id="d_bcode"></div></td> </tr>--> <tr></tr> <tr> <th align="left">Username</th> <td><input type="text" name="uname" id="uname" size="27" class="border"></td> <td class='err'><div id="d_uname"></div></td> </tr> <tr></tr> <tr> <th align="left">Password</th> <td><input type="password" name="pwd" id="pwd" size="27" class="border"></td> <td class='err'><div id="d_pwd"></div></td> </tr> <tr></tr> <tr> <th align="left">Retype Password</th> <td><input type="password" name="rpwd" id="rpwd" size="27" class="border"></td> <td class='err'><div id="d_rpwd"></div></td> </tr> <tr> <td></td> </tr> <tr></tr> <tr> <td></td> <td><input type="submit" value="Register" name="reg1" id="reg1" onclick="return validate()" ></td> </tr> </table></form></div> Hi, First i don know if im posting at the right place or if you even take request here, feel free to direct me to the right place. What i am looking for is someone to make a simple counter for me. Basically i want that every time i press a certain key on my keyboard it will increase the counter amount and would then divide it by 60 every hour. Actually im looking for it to only show that average and refresh every hour. So it would start at 0 then update after the first hour and so on. (I also need a graphical interface) I have very few knowledge in coding and would very appreciate if someone could do that for me. Thank you ! Reply With Quote 01-10-2015, 11:39 PM #2 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts I don't think this is something you would do with JavaScript. I think you need a ".exe" (on Windows) program. And that's a lot more complex. The problem is your request to capture a certain key, presumably no matter what window is at the front. Normally, within a given window, you can only capture a key that is intended for that window. I don't think this is a very easy thing to do. I have 2 questons. 1) Is there a way for the loop counter to loop while less then [a php variable]? 2) Is there a way to use a counter in the name of the form elements? Example, instead of "switchBox1" use: "switchBoxCounter" instead of "nameaddy1" use: "nameaddyCounter" Code: if(document.form1.switchBox1.checked) { document.form1.nameaddy1.style.backgroundColor = "#E5E5E5"; } else { document.form1.nameaddy1.style.backgroundColor = "#FFFFFF"; } Hello, I am a hobbyist coder making a basic website for a friend, and I have a small problem. On an image slideshow, there is a counter at the bottom showing what image it is up to (ie 7/15), I'm not entirely sure how to change this into double digits (ie 07/15) I've found this thread (http://www.codingforums.com/showthread.php?t=212321) but am unsure how to integrate it into the slideshow I'm using, which is a different one. Here is the part from my JS I think that needs modifying: Code: if (setting.displaymode.type=="manual" && !setting.displaymode.wraparound){ this.paginatecontrol() } if (setting.$status) //if status container defined setting.$status.html(setting.curimage+1 + " / " + totalimages) Is this the right bit of code? If more of the code is needed to solve this please let me know. Any help is greatly appreciated! |