JavaScript - Validation / Time Limit / Online Ordering Site
Similar TutorialsHello, Is there any way that I can add a limit for the amount of time that a javascript loader bar stays on screen? The specific loading screen I am using is http://www.fliesen-info-spanien.net/loadbox.php. This loading box actually activates once the page is loaded apparently, but in my instance, it is loading then disappearing in the matter of a second, but I wouldnt mind leaving it up for a couple of seconds, say 3-5. Is there any line of code I can add to do this? Andy hi, i am now playing with the time. can you please tell me how to make the time move in downwards, i mean a countdown like format, e.g the time will start countdown and end in 2 days? here's my initial noob code for creating time Code: <script type="text/javascript"> var today = new Date(); h = today.getHours(); m = today.getMinutes(); s = today.getSeconds(); function showDate(){ if(document.getElementById('but').value = "locked"){ h = checktime(h); m = checktime(m); s = checktime(s); } document.getElementById('t').innerHTML = h +":"+m+":"+s; } function checktime(i){ if(i < 10){ i = "0" + i; } return i; } function ocl(){ var x = true; if(x){ document.getElementById('but').value = "locked"; showDate(); } } function mo(){ document.getElementById('but').value = "lock me ?"; x = false; } </script> <h3> <a id="t"></a> </h3> <input type="button" id="but" value="unlocked" onmouseover="mo();" onclick="ocl();" /> Hi All I am not a genius when it comes to javascript so if anyone could help, I would really be grateful. scenario: I am creating a custom product (75g) which will be made up of 3 others products (25g + 25g + 25g). The 3 options will be made up of a combination of smaller products each with their own options (25g, 50g, 75g) which will allow the customer to have one of each or fill up all 3 with just one type. Here is what I have in code already: Code: <div class="wrapperAttribsOptions"> <h4 class="optionName back">Organic Sour Worms</h4> <div class="back"> <input name="id[14][48]" value="48" id="attrib-14-48" type="checkbox"><label class="attribsCheckbox" for="attrib-14-48">25g</label><br> <input name="id[14][49]" value="49" id="attrib-14-49" type="checkbox"><label class="attribsCheckbox" for="attrib-14-49">50g</label><br> <input name="id[14][50]" value="50" id="attrib-14-50" type="checkbox"><label class="attribsCheckbox" for="attrib-14-50">75g</label><br> </div> <br class="clearBoth"> </div> <br class="clearBoth"> <div class="wrapperAttribsOptions"> <h4 class="optionName back">Organic Sugar Bears</h4> <div class="back"> <input name="id[15][51]" value="51" id="attrib-15-51" type="checkbox"><label class="attribsCheckbox" for="attrib-15-51">25g</label><br> <input name="id[15][52]" value="52" id="attrib-15-52" type="checkbox"><label class="attribsCheckbox" for="attrib-15-52">50g</label><br> <input name="id[15][53]" value="53" id="attrib-15-53" type="checkbox"><label class="attribsCheckbox" for="attrib-15-53">75g</label><br> </div> <br class="clearBoth"> </div> <br class="clearBoth"> <div class="wrapperAttribsOptions"> <h4 class="optionName back">Organic Fruit Cocktail</h4> <div class="back"> <input name="id[16][54]" value="54" id="attrib-16-54" type="checkbox"><label class="attribsCheckbox" for="attrib-16-54">25g</label><br> <input name="id[16][55]" value="55" id="attrib-16-55" type="checkbox"><label class="attribsCheckbox" for="attrib-16-55">50g</label><br> <input name="id[16][59]" value="59" id="attrib-16-59" type="checkbox"><label class="attribsCheckbox" for="attrib-16-59">75g</label><br> </div> <br class="clearBoth"> </div> <br class="clearBoth"> <div class="wrapperAttribsOptions"> <h4 class="optionName back">Organic Jelly Bears</h4> <div class="back"> <input name="id[17][57]" value="57" id="attrib-17-57" type="checkbox"><label class="attribsCheckbox" for="attrib-17-57">25g</label><br> <input name="id[17][58]" value="58" id="attrib-17-58" type="checkbox"><label class="attribsCheckbox" for="attrib-17-58">50g</label><br> <input name="id[17][60]" value="60" id="attrib-17-60" type="checkbox"><label class="attribsCheckbox" for="attrib-17-60">75g</label><br> </div> <br class="clearBoth"> </div> What I need to do is to some how ensure that the product is filled with 75g worth of the other products. Another option may to not use the 'grams' but rather use the 3 compartments that will be filled so 25g = 1, 50g = 2, 75g = 3 etc. Note: Name, Values, Ids are made dynamically by the cart, and I cannot change those as they are used for adding to cart and updating account info etc. PLEASE PLEASE PLEASE if anyone can help, I would really appreciate it. ----------------------------- Jay This is my first javascript game and it's pretty much built of code I've gathered over time and cleaned up. Here's a manipulated screenshot of what I'm trying to accomplish. You're an ant and you want those goodies on the map as quickly as possible! click this link to view a bigger manipulated screenshot click this link to view the goodies (items) The ant is the playable character you control by using the arrow keys. Every time you load the page, or click "restart game", three new items will spawn randomly on the level and the time will be reset to 0 seconds. An arrow key must be pressed to start the time counter and the game itself. There are only 5 items so far, cheese, apple, banana, candy and donut. The items are supposed to be collected as quickly as possible, when the last item has been collected (by simply running over it) the game will end, save the time and display a hi-score list. Time limit is 30 seconds, the game will display a classic "GAMER OVER" if the limit is overrided. Problems I'm trying to solve: 1: Fullscreen mode (and make the ant actually STAY on the screen) I want the game level to adapt itself to the computer screen. The game dimensions are 1000x600px at the moment but the ant does not respect the level dimensions. Screenshot: http://i41.tinypic.com/kc1j81.jpg. I have a feeling about that somekind of percental code has to be implented but I've never done this before. (Please note that the size of the ant and the items will remain as they are) 2: Spawning three items randomly on the level I drew 5 items and saved them as 100x100 PNG. Three of these items have to spawn at a random location on the fullscreen level. The LAST item collected must trigger the time counter to stop. The time will later be used on the hi-score list where he/she can type her nickname. This information will be uploaded to a database. 3: 30 second time limit Letting the time counter reach 30 seconds will trigger a "GAME OVER". The only way to try again is page refresh or "restart game". Code: <html> <head> <style type="text/css"> div#game { width:1000px; height:600px; position:absolute; background:#c3c3c3; } </style> <script type='text/javascript'> // movement vars var xpos = 100; var ypos = 100; var xspeed = 1; var yspeed =1; var maxSpeed = 5; // boundary var minx = 0; var miny = 0; var maxx = 1000; // characters movement field, width var maxy =600; // characters movement field, height // controller vars var upPressed = 0; var downPressed = 0; var leftPressed = 0; var rightPressed = 0; function slowDownX() { if (xspeed > 0) xspeed = xspeed - 1; if (xspeed < 0) xspeed = xspeed + 1; } function slowDownY() { if (yspeed > 0) yspeed = yspeed - 1; if (yspeed < 0) yspeed = yspeed + 1; } function gameLoop() { // change position based on speed xpos = Math.min(Math.max(xpos + xspeed,minx),maxx); ypos = Math.min(Math.max(ypos + yspeed,miny),maxy); // or, without boundaries: // xpos = xpos + xspeed; // ypos = ypos + yspeed; // change actual position document.getElementById('character').style.left = xpos + "px"; document.getElementById('character').style.top = ypos + "px"; // change speed based on keyboard events if (upPressed == 1) yspeed = Math.max(yspeed - 1,-1*maxSpeed); if (downPressed == 1) yspeed = Math.min(yspeed + 1,1*maxSpeed) if (rightPressed == 1) xspeed = Math.min(xspeed + 1,1*maxSpeed); if (leftPressed == 1) xspeed = Math.max(xspeed - 1,-1*maxSpeed); // deceleration if (upPressed == 0 && downPressed == 0) slowDownY(); if (leftPressed == 0 && rightPressed == 0) slowDownX(); // loop setTimeout("gameLoop()",10); } function keyDown(e) { var code = e.keyCode ? e.keyCode : e.which; if (code == 38) upPressed = 1; if (code == 40) downPressed = 1; if (code == 37) leftPressed = 1; if (code == 39) rightPressed = 1; } function keyUp(e) { var code = e.keyCode ? e.keyCode : e.which; if (code == 38) upPressed = 0; if (code == 40) downPressed = 0; if (code == 37) leftPressed = 0; if (code == 39) rightPressed = 0; } </script> </head> <body onload="gameLoop()" onkeydown="keyDown(event)" onkeyup="keyUp(event)" bgcolor='gray'> <!-- level --> <div id="game"></div> <!-- ant character --> <img id='character' src='images/ant.png' style='position:absolute;left:500px;top:500px;height:125px;width:200px;'/> </body> </html> time validation for text box valid time in 24 hours format with no seconds my textboxes have same name and id with array i am alerting the text box value onblur.It shows only the first text box value I want to alert for every text box if value is not a number Code: <?php session_start(); if (!$_SESSION['uname']) header("Location:login.php"); ?> <html><head><title>Attendance sheet</title> <link rel="stylesheet" href="att_style.css" type="text/css" > <script type="text/javascript"> function IsNumber(strAlert) { //alert(strAlert); var txtb = document.getElementById('in_time[]').value; //for (var i = 0; i < txtb.length; i++) { //var txtv = txtb[i].value; alert(txtb); //} } </script> </head> <body> <?php $cnn = mysql_connect("localhost","root",""); mysql_select_db("time_sheet",$cnn); $dbdate = mysql_query("SELECT start_mon,end_mon FROM admin"); $dd = mysql_fetch_array($dbdate); $curmon = getdate(); $nextmonth = $curmon['mon'] + 1; $start = "2012" . "-" . $curmon['mon'] ."-". $dd['start_mon']; $end = "2012" . "-". $nextmonth ."-". $dd['end_mon']; $_SESSION['fromdate'] = $start; $_SESSION['todate'] = $end; $dateMonthYearArr = array(); $fromDateTS = strtotime($start); $toDateTS = strtotime($end); for ($currentDateTS = $fromDateTS; $currentDateTS <= $toDateTS; $currentDateTS += (60 * 60 * 24)) { $currentDateStr = date("M d",$currentDateTS); $notmysql[] = $currentDateStr; $currmysql = date("Y-m-d",$currentDateTS); $mysqlfor[] = $currmysql; } echo " No of days: " . count($mysqlfor); //Table for view if (isset($_REQUEST['sub'])) { $inti = $_POST['in_time']; $outi = $_POST['out_time']; $intime = serialize($inti); $outtime = serialize($outi); $inser = unserialize($intime); $outser = unserialize($outtime); $dbdate = mysql_query("SELECT start_mon,end_mon FROM admin"); $dd = mysql_fetch_array($dbdate); $curmon = getdate(); $nextmonth = $curmon['mon'] + 1; $dateMonthYearArr = array(); $fromDateTS = strtotime($start); $toDateTS = strtotime($end); for($b = 0; $b < count($mysqlfor); $b++) { $qry = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$b]."' "); $ds = mysql_fetch_array($qry); if(!$qry) die(mysql_error()); $check = mysql_num_rows($qry); // print_r($inser); if($check == 0) { if($inser[$b] == "") $inser[$b] = '00:00'; if($outser[$b] == "") $outser[$b] = '00:00'; $ins = mysql_query("INSERT INTO timetable VALUES ('', '".$_SESSION['uname']."', '".$mysqlfor[$b]."', '".$inser[$b]."', '".$outser[$b]."', '') "); } else { //print_r($mysqlfor[$b]); $upd = mysql_query("UPDATE `timetable` SET `in` = '".$inser[$b]."', `out` = '".$outser[$b]."' WHERE `date` = '".$mysqlfor[$b]."' "); if(!$upd) die(mysql_error()); } } } ?> <form name="myForm" method="post" action=""> <table border="1" cellspacing="0" cellpadding="2"> <tr><th scope="row">DATE</th> <?php for ($s = 0; $s < 10; $s++) { ?> <td align="center"><?php print_r($notmysql[$s]); } ?></td></tr> <tr><th scope="row">IN</th> <?php for ($ss = 0; $ss < 10; $ss++) { ///////////////getting from DB $sele = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$ss]."' "); $emp = mysql_num_rows($sele); ?> <td align="center"> <?php $numrows = mysql_num_rows($sele); if($numrows == 0) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"> </td> <?php } else { while($row1 = mysql_fetch_array($sele)) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" value="<?php echo $row1['in']; ?>" size="5"></td> <?php } } }?> </tr> <tr><th scope="row">OUT</th> <?php for ($v = 0; $v < 10; $v++) { ?> <td align="center"> <?php $sel2 = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$v]."'"); $numrows = mysql_num_rows($sel2); if($numrows == 0) { ?> <input name="out_time[]" id="out_time[]" type="text" size="5"></td> <?php } else { while($row2 = mysql_fetch_array($sel2)) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" value="<?php echo $row2['out']; ?>" size="5"></td> <?php } } }?> </tr> <tr><th scope="row">Late</th><?php for ($s = 0; $s < 10; $s++) { ?> <td align="center"><input name="late_time[]" id="late_time[]" onBlur="IsNumber();" type="text" size="5"></td> <?php }?> </tr> </table> <br><br> <!-- second tab--> <?php if(count($notmysql) >= 11) { ?> <table border="1" cellspacing="0" cellpadding="2"><tr><th scope="row">DATE</th> <?php for ($st = 10; $st < 20; $st++) { ?> <td align="center"><?php print_r($notmysql[$st]); ?></td> <?php } ?></tr> <tr><th scope="row">IN</th> <?php for ($g = 10; $g < 20; $g++) { $selec = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$g]."'"); $numrows = mysql_num_rows($selec); ?> <td align="center"> <?php if($numrows == 0) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($secinrow = mysql_fetch_array($selec)) { ?> <input name="in_time[]" id="in_time[]" value="<?php echo $secinrow['in']; ?>" onBlur="IsNumber();" type="text" size="5"></td> <?php } } }?></tr> <tr><th scope="row">OUT</th> <?php for ($h = 10; $h < 20; $h++) { $select = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$h]."'"); ?> <td align="center"> <?php $numrows = mysql_num_rows($select); if($numrows == 0) {?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($secoutrow = mysql_fetch_array($select)) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" value="<?php echo $secoutrow['out']; ?>" size="5"></td> <?php } } }?></tr> <tr><th scope="row">Late</th> <?php for ($m = 10; $m < 20; $m++) { ?> <td align="center"><input name="late_time[]" id="out_time[]" onBlur="IsNumber();" type="text" size="5"></td> <?php } ?> </tr> </table> <?php } ?> <br/><br/> <!-- Third table--> <?php if(count($notmysql) >= 21) { ?> <table border="1" cellspacing="0" cellpadding="2"> <tr> <th scope="row">DATE</th> <?php for ($tt = 20; $tt < count($notmysql); $tt++) { ?> <td align="center"><?php print_r($notmysql[$tt]); ?></td><?php } ?> </tr> <tr><th scope="row">IN</th> <?php for ($j = 20; $j < count($notmysql); $j++) { $selected = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$j]."' "); ?> <td align="center"> <?php $numrows = mysql_num_rows($selected); if($numrows == 0) {?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($treinrow = mysql_fetch_array($selected)) { ?> <input name="in_time[]" id="in_time[]" type="text" onBlur="IsNumber();" value="<?php echo $treinrow['in']; ?>" size="5"></td> <?php } } } ?> </tr> <tr><th scope="row">OUT</th> <?php for ($k = 20; $k < count($notmysql); $k++) { $selectedr = mysql_query("SELECT * FROM timetable where date = '".$mysqlfor[$k]."'"); $numrows = mysql_num_rows($selectedr); ?> <td align="center"> <?php if($numrows == 0) { ?> <input name="out_time[]" id="out_time[]" type="text" onBlur="IsNumber();" size="5"></td> <?php } else { while($treoutrow = mysql_fetch_array($selectedr)) { ?> <input name="out_time[]" id="out_time[]" onBlur="IsNumber();" value="<?php echo $treoutrow['out']; ?>" type="text" size="5"></td> <?php } } } ?> </tr> <tr><th scope="row">Late</th> <?php for ($s = 20; $s < count($notmysql); $s++) { ?> <td align="center"> <input name="late_times[]" id="late_times[]" type="text" value="<?php ?>" size="5"></td> <?php } ?> </tr> </table> <?php } ?> <!--Table End --> <a style="float:right" href="logout.php">Logout</a> <p align="center"><input name="sub" type="submit" value="Save"></p> </form> </body> </html> Hello, I have an existing php contact form which incorporates php validation (required name with only characters, valid email address format, and minimum message length) and re-captcha. I would like to add some "real time" validation to the fields on my form (there are 3 fields - name, email and message) before the "Submit" button is pressed. For example when the user tabs from one text box to the next but hasn't filled in the required information. I am totally new to any type of java, but am I right in thinking I need either JavaScript, Ajax or JQuery to perform real-time validation? If so, which should I be looking into and are there any basic examples of form validation? I want to keep my pup validation as I'm aware that php is client-side but still needed as people can turn Java off in their web browsers. Any tips and pointers will be very much appreciated! Thankyou, Tom I've got no knowledge/experience of javascript, but i'm pretty competent with html and css. I've put together a site for my University radio statio, and i'd like to have a section that displays the show name thats broadcasting at the time. Can anyone point me towards a script, or tutorial, that might help me out? Thanks in advance! Hi all, I have an array containing numbers. I want to order this numbers contained from major to minor in order to print them .. Here's what I have done: Code: var arr = new Array(6); arr[0] = "10"; arr[1] = "5"; arr[2] = "40"; arr[3] = "25"; arr[4] = "1000"; arr[5] = "1"; function sortNumber(a,b) { return b - a; } for(var i=0;i < 6; i++){ var myarray = arr[i]; myarray.sort(sortNumber); alert(myarray); } But I get no alert and a "myarray.sort is not a function" error. What am I doing wrong? How can I solve this? Thanks a lot in advance! hi im using dhtml xgrid where i need to do validation for time ,(from-time and to-time i.e ind==1 and ind==2 ) to-time must be greater than from-time else i need to alert a message to-time must be greater than from-time. can any one send me the code for it time format is[05:00]. Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } Hello im using dhtmlx grid in this cells i have from time and to time (i.e ind==1 and ind==2) i need to validate time where to-time must be greater than from-time else it should alert an message,i have writeen a normal Regular expression for the time validation.as the time is i string format i.e[05:00],please can any one send me code for that. Code: var err_str=""; function validate_grid(value,id,ind) { if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } Hi Code: var err_str=""; function validate_grid(value,id,ind) { $("#result").html(" ").show(); if(ind==1 || ind==2) { var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/; if(!patt.test(value)) { mygrid.setCellTextStyle(id,ind,"background-color:yellow;"); if(err_str!="") err_str+="\n"+(ind+1)+".Enter numbers and : only.."; else err_str=(ind+1)+".Enter numbers and : only"; return false; } else { mygrid.setCellTextStyle(id,ind,"background-color:white;"); return true; } } } alert(err-str); here ind==1 is from_time and ind==2 is to_time,i need to validate time as to_time must be always greater than from-time,if condition fails an alert msg should populate.time format is[05:00]as it is in string format im unable to do the validation for it.(ex:from-time=08:00 to-time=07:59 condition fails) thank you. 1 down vote favorite I do have the countdown script (see link below) to display the time between current time and the date given in real-time. However, I want to achieve to display the time difference between a given start and end time. Right now, it calculates from the current server time to the end time. I want to be able to set up my own start time and end time. Here is what I have: http://jsfiddle.net/BgEtE/ thank you for help hi, can some one help me how to get the time and date difference? given two time and date with the following format like in textbox A: 2011-05-03 17:35:47.0 and textbox B: 2011-05-03 16:35:47.0 then the output would be: 0 days, 1 hour, 0 minutes, 0 seconds regards, verve I'm not really a Java writer, so I don't know how to do this myself, though I imagine it would be pretty simple. I am looking to add a script to a webpage that allows users to input a time manually, and have it converted to GMT/Zulu time and display the converted time. I have seen a lot of time zone conversion scripts online, but they all just convert whatever the current system time is to another time zone. I am looking for a script that allows users to convert a time and show the zulu time, for times other than the current time. The time zone the inputed local time would be in is +4:30 (Kabul). I don't really care about style or aestehtics, just a simple script I can insert into a web page to have a time input field. The converted output time can appear in another field, a popup bubble, etc, again style isn't really an issue. It's really just to help people in my job who need to know what the GMT/Zulu time was for certain local times after the fact. One would think it shouldn't be that hard to just subtract 4:30 in your head, but apparently it is. Sorry if just asking for code outright like this is frowned upon. Hey all. I have a simple validation I need to do. I need to just make sure that a Checkbox is checked, and that a Text field has content. Sounds simple but I cannot find any thing that has a check and a text field. Here what I have. Can I modify this script to do this? A Checkbox MUST be checked and Text field MUST be filled out. This currently does the text field fine, but no Checkbox obviously. How can I add a checkbox validation to this? Thats it. Any help is appreciated. Code: <script type="text/javascript"> var textFields = ["digsig"]; function validateForm( ) { var oops = ""; // must initialize this! var form = document.sig; for ( var t = 0; t < textFields.length; ++t ) { var field = form[textFields[t]]; var value = field.value.replace(/^\s+/,"").replace(/\s+$/,""); // trim the input if ( value.length < 1 ) { oops += "You MUST enter your Digital Signature"; } } if ( oops != "" ) { alert("ERROR:" + oops); return false; } } } </script> This is my first time doing JavaScript I don't what I did wrong here, but the problem its not showing up the current date and time. Code: <script language = "JavaScript" type="text/javascript"> now = new Date(); localtime = now.toString(); utctime = now.GMTString(); document.wite("<b>localtime</b>" + localtime + "</br>"); document.write("<b>utctime</b>" + utctime); </script> This is what supposed to look like I have tried using different browser chrome,IE9,Maxtor, and Opera my OS is Win7 Hello all, new here Seems like a very nice place to be apart of. I have my website www.gebcn.com. If you view source you will see all that I have done, but more importantly my problem. I have the JS code at the top there and I am unable to W3C validate my HTML because of the JS. I am using XHTML strict and would like to stay using it. The JS I have at the top is my form validation code. I am able to do any validating that I need with this "snippet" of code, I have shrank it from my library version just to use for this newsletter. Until now W3C validating was not important now for some reason it is and I am faced with this problem. I am not a Javascript guy more of a HTML/CSS guy and I can manipulate JS to suit my needs. <problem> I have tried to make this "snippet" of JS code an external file but receive multiple errors with the JS calling for the FORM NAME as it is not on the same page. The form NAME=NEWSLETTER is another problem, as W3C says I am unable to use attribute "NAME" in this location. <problem> I would like to keep the JS close to how it is now as I have a library to use this JS over and over again. Any pointers in the right direction or solutions to my problem would be greatly appreciated. Thanks! Hopefully it is not to hard huh If there is anything anyone needs, the code pasted here, or anything else please let me know. Thanks again! Dear Friends, please give your solution about below problem. I call function test".$i."(){ edit($('$paket_id')); } function for editing in line text. <div onclick="test".$i."(this)"><img src="./images/edit01.png"></div> http://www.freeimagehosting.net/l5raa But when I click to call link, the textarea are opening again. How I can limit this? Is it possible to limit a textarea input with a max amount of letters? So if the form said 1,000 character limit. Can it block it after the 1,000th one is reached? I am hoping someone can help me with a tweak to my current online quiz code. I know very little javascript but was thinking this might be an easy change. I need a funtion to get all the quiz answers ( I'm using radio buttons with values assigned) Values of each question answered will be added together Results are determined by 3 score ranges and displayed on the appropriate html page I have this code from a different quiz but not able to figure out how to change it to get the results I need. Please be gently with with!!! I am just learning. Code: function finish() { var ext = '.html'; var results = new Array("none","results1","results2","results3"); var nums = new Array(4); for(var i = 0; i < nums.length; i++) nums[i] = 0; for(var i = 1; i <= 9; i++) { var q = document.forms['quiz'].elements['question_'+i]; if(q[0].type=='checkbox') { var n = 0; } for(var j = 0; j < q.length; j++) { if(q[j].checked) { var a = q[j].value.split(','); for(var k = 0; k < a.length; k++) { nums[a[k]]++; } if(q[j].type=='radio') break; else n++; } if(j == q.length-1&&q[j].type=='radio') {nums[0]++;} } if(q[0].type=='checkbox'&&((document.forms['quiz'].elements['question_'+i+'_min']&&n<document.forms['quiz'].elements['question_'+i+'_min'].value)||(document.forms['quiz'].elements['question_'+i+'_max']&&n>document.forms['quiz'].elements['question_'+i+'_max'].value))) nums[0]++; } var j = new Array('0'); for (i in nums) if(nums[i]>nums[j[0]]){j=new Array(''+i);} else if(nums[i]==nums[j[0]])j[j.length] = i; //var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n'; //alert(o); if(nums[0]!=0) { alert('You missed or incorrectly answered '+nums[0]+' questions!'); } else if(j[0]==0) { alert('No result could be determined.'); } else { location = results[j[0]]+ext; } } Please let me know if I am way off base or if there is a better way to attach the project. Most Grateful, TechPam |