JavaScript - Help With My Javascript Code:validating Dob
<HTML>
<HEAD> <TITLE>Form Validation Example </TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function validateForm() { if(document.UD.FIRST_NAME.value=="") { alert("PLEASE FILL IN THE First Name FIELD"); return(false); }// validation for empty first name if(document.UD.LAST_NAME.value=="") { alert("PLEASE FILL IN THE Last Name FIELD"); return(false); }// validation for empty last name if(document.UD.MONTH.value=="") { alert("PLEASE FILL IN THE Birth Date FIELD"); return(false); }//validation for empty month if(document.UD.DAY.value=="") { alert("PLEASE FILL IN THE Birth Date FIELD"); return(false); } //validation for empty day if(document.UD.YEAR.value=="") { alert("PLEASE FILL IN THE Birth Date FIELD"); return(false); }//validation for empty year if(document.UD.MONTH.value >=1 && document.UD.MONTH.value <=12) { return(true); } else{ alert("Please enter a valid Month"); return(false); } /* this runs its course but stops after it makes this statement true. It does not continue the last to if statements. I have rearranged the code to read: if(document.UD.MONTH.value <=0) { alert("Please enter a valid Month"); return(false); } if(document.UD.MONTH.value >=12) { alert("Please anter a valid Month") return(false); } but by following these statments it skips these and goes straight to the next if statement and follows that until it reaches true then it won't go onto the last if statment.*/ if(document.UD.DAY.value >=1 && document.UD.DAY.value <=32) { return(true); } else{ alert("Please enter a valid day"); return(false); } if(document.UD.YEAR.value >=1900 && document.UD.YEAR.value <=2011) { return (true); } else { alert("Please enter a valid year"); return(false); } return(true); } //--> </SCRIPT> </HEAD> <BODY> <CENTER> <FONT SIZE="5" COLOR="#006600" FACE="verdana">Form Validation</FONT> </CENTER><BR><BR> <FORM METHOD=POST ACTION="http://www.mysite.com" NAME="UD"> <TABLE ALIGN="CENTER"> <TR> <TD>First Name</TD> <TD><INPUT TYPE="TEXT" NAME="FIRST_NAME"></TD> </TR> <TR> <TD>Last Name</TD> <TD><INPUT TYPE="TEXT" NAME="LAST_NAME"></TD> </TR> <TR> <TD>Birth Date</TD> <TD><INPUT TYPE="TEXT" SIZE="4" NAME="MONTH"><INPUT TYPE="TEXT" SIZE="4" NAME="DAY"><INPUT TYPE="TEXT" SIZE="6" NAME="YEAR"> </TD> </TR> <TR> <TD><INPUT TYPE="SUBMIT" VALUE="Submit Form" onClick="return validateForm()"></TD> <TD><INPUT TYPE="RESET" VALUE="Reset"></TD> </TR> </TABLE> </FORM> </BODY> </HTML> Above is my code. I have included a brief snippet of my problem in the code already, but basically my code runs through all the if statements until it gets to the if statement about the month and validating what numbers are used. Once it completes that if statement it returns true and goes no further. However if I rearrange my code it still does not work. If anyone has some idea on what I am doing I would greatly appreciate it. I am new to javascript and have been working on this for hours upon hours trying to figure it out so any help would be greatly appreciated. Thank you. Similar TutorialsHi, I'm wondering if someone can help me. I have recently used this tutorial: http://net.tutsplus.com/tutorials/ph...-confirmation/ to develop a more complex sign up form for a competition for a client. Basically, the way the validation has been done is different to many other validation methods I've used before and don't understand how to implement it, for some additional requirements. This is an example of the PHP validation code that I have altered, to suit my form requirements: Code: //quick/simple validation if(empty($code)){ $action['result'] = 'error'; array_push($text,'You forgot to enter your entry code'); } if(empty($name)){ $action['result'] = 'error'; array_push($text,'You forgot to enter your name'); } if(empty($email)){ $action['result'] = 'error'; array_push($text,'You forgot to enter your email address'); } This code only validates that there is content in those fields. But, for example on the 'entry code' field, I would like to put a maximum character input there and restrict certain characters, as well as a standard 'email' validation, so that the form is sent through to the database correctly. If anyone knows how I can do this, with this sign-up form in particular, please assist me, as every other method I've tried to work with this form hasn't worked and caused the form to error. Thank you in advance. We are trying to validate a piece of code on our HTML pages and get the following message - "The text content of element script was not in the required format: Expected space, tab, newline, or slash but found < instead." The code is used to set up the Facebook tags in JavaScript, and does work by itself. However, we're trying to get it to work through validation on http://validator.w3.org Code: <script src="SiteTools.js"> //<![CDATA[ <!-- FacebookSetup('CABLED Project first 6 months', 'images/angela-imiev.jpg'); //--> //]]> </script> Thanks Hi, Please this form code is not working,please help correct me with the right code. When i did not enter anything onthe field require ,thealert does not pop up making the form inaccurate. Code: <script type="text/javascript"> function validateForm() { function CheckEmail() var x=document.frmone.email.value; var atpos=x.indexOf("@"); var dotpos=x.lastIndexOf("."); if(atpos<1 || dotpos<atpos+2 ||x.length>30){ alert("not a valide email address"); return false } function CheckUsername() { var x=document.frmone.fname.value; if(x==null || x==""){ alert("username is required"); return false } } </script> <form name="frmone" method="post" action="" onsubmit="validateForm()"/> <input type="text" name="email"/> <input type="submit" name="submit"/> <input type="text" name="fname"/> <input type="submit" name="submit"/> </form> Help me. Thanks. Clement Osei. hi i need a help in java script. i have some text fields and when i enter the information in it and enter the validation button i need the results to be displayed in a box below these btns. Is it possible in Java script? Please see the attached image for some ideas. cheers Can someone provide a code sample which uses RegExp in JavaScript to validate an email type of input in an HTML form?
hi im new to scripting so apologies if this is a basic question. I have a form which has javascript validation which triggers hidden divs if certain input boxes are left blank. I have it working with text fields and text areas, but im having trouble with a drop down menu. This is the code for my drop down: Code: <select name="department" size="1" id="department"> <option value="" selected>Please select</option> <option value="1">Personal Injury</option> <option value="2">ULR & Credit Hire</option> <option value="3">Consumer Credit</option> <option value="4">Health & Safety</option> <option value="5">Property</option> </select> And this is the code currently for the Javascript validating: Code: if(department.selectedIndex == 0){ var error = true; $('#department_error').fadeIn(500); }else{ $('#department_error').fadeOut(500); If i leave the drop down on the 'Please Select' value, the error message should show, but at the moment it doesnt show up. I have a feeling the syntax is wrong in the javascript? Any help very much appreciated Thanks hello everyone Im new to javascript as well as to this forum, Im coming here for first class help that I can only get from skilled programmers like you. I have a html form that uses javascript for validation, this is an assignment that consists of a form that sells hard drives from three different manufacturers, more specifically the part im stuck on is where if a manufacturer hoes have a number in the number of drives textbox, javascript needs to check to see that one of the radio buttons in that row is checked, if no radio button is checked an alert is displayed, however when I do select a radio button I still get the alert I used a "if...else if...else" construction but my logic is not well structured and thereby I get those problems, I have included the code down below if anyone is interested in helping a newbie out, thanks Code: <html> <head> <style type="text/css"> .bold {font-weight:bold ; font-family:"comic sans ms"} </style> <script type="text/javascript"> function number_of_drives() { //checks that a value is entered for at least one drive's manufacturer if(document.myform.drive1.value=="" && document.myform.drive2.value=="" && document.myform.drive3.value=="") { alert("please enter a quantity for the number of drives you wish to purchase from a manufacturer"); //if no value is entered in any the message is displayed return; //no further calculation is done } else if(isNaN(document.myform.drive1.value || document.myform.drive2.value || document.myform.drive3.value ))//verifies that only numeric values were entered { alert("make sure you enter a numeric values for the 'number of drives' column"); return; } else { if(document.myform.drive1.value !="" && document.myform.western[0].checked==false && document.myform.western[1].checked==false && document.myform.western[2].checked==false) alert("please select a size for the western digital drive"); else if(document.myform.drive2.value !="" && document.myform.maxtor[0].checked==false && document.myform.maxtor[1].checked==false && document.myform.maxtor[2].checked==false) alert("please select a size for the maxtor digital drive"); else if(document.myform.drive2.value !="" && document.myform.quantum[0].checked==false && document.myform.quantum[].checked==false && document.myform.quantum[2].checked==false) alert("please select a size for the quantum digital drive"); } } function check_radios()//function to check that a size is selected in the same row as the number of drives textbox//function to check that a size is selected in the same row as the number of drives textbox { if(document.myform.drive1!="" && document.myform.western[0].checked==false && document.myform.western[1].checked==false && document.myform.western[2].checked==false)// if drive1 textbox is not empty and no radio button is selected, a message will appear { alert("please select a size for the 'western digital' drive"); return; } else{return;} if(document.myform.drive2!="" && document.myform.maxtor[0].checked==false && document.myform.maxtor[1].checked==false && document.myform.maxtor[2].checked==false)// if drive2 textbox is not empty and no radio button is selected, a message will appear { alert("please select a size for the 'maxtor' drive"); return; } else{return;} if(document.myform.drive3!="" && document.myform.quantum[0].checked==false && document.myform.quantum[1].checked==false && document.myform.quantum[2].checked==false) // if drive2 textbox is not empty and no radio button is selected, a message will appear { alert("please select a size for the 'quantum' drive"); return; } else{return;} } function clear_form() { document.myform.western[0].value==""; document.myform.western[1].value==""; document.myform.western[2].value==""; document.myform.maxtor[0].value==""; document.myform.maxtor[1].value==""; document.myform.maxtor[2].value==""; document.myform.quantum[0].value==""; document.myform.quantum[1].value==""; document.myform.quantum[2].value==""; document.myform.drive1.value==""; document.myform.drive2.value==""; document.myform.drive3.value==""; document.myform.size1.value==""; document.myform.size2.value==""; document.myform.size3.value==""; document.myform.totalsize.value==""; document.myform.totalcost.value==""; document.myform.discount.value==""; document.myform.grandtotal.value==""; } </script> <title></title> </head> <body> <form name="myform"> <table align="center" border="1" width="80%"> <tr style="font-family:'comic sans ms'; font-size:24pt"><td align="center" colspan="6">Rupert's Hard Drive Emporium</td></tr> <tr><td class="bold" valign="middle" align="center" rowspan="2">Manufacturer</td><td colspan="3" align="center" class="bold">Drive Size</td><td rowspan="2" class="bold">Number of Drivers</td><td rowspan="2" class="bold">Number of GB</td></tr> <tr><td class="bold">500 Gigabytes</td><td class="bold">1 Terabyte</td><td class="bold">2 Terabytes</td></tr> <tr><td>Western Digital ($0.12/GB)</td><td align="center"><INPUT TYPE=RADIO NAME="western" value="500" /></td><td align="center"><INPUT TYPE=RADIO NAME="western" value="1024"/></td><td align="center"><INPUT TYPE=RADIO NAME="western" value="2048"/></td><td align="center"><input type="text" name="drive1"/></td><td align="center"><input type="text" name="size1"/></td></tr> <tr><td>Maxtor ($0.16/GB)</td><td align="center"><INPUT TYPE=RADIO NAME="maxtor" value="500"/></td><td align="center"><INPUT TYPE=RADIO NAME="maxtor" value="1024"/></td><td align="center"><INPUT TYPE=RADIO NAME="maxtor" value="2048"/></td><td align="center"><input type="text" name="drive2"/></td><td align="center"><input type="text" name="size2"/></td></tr> <tr><td>Quantum ($0.09/GB)</td><td align="center"><INPUT TYPE=RADIO NAME="quantum" value="500"/></td><td align="center"><INPUT TYPE=RADIO NAME="quantum" value="1024"/></td><td align="center"><INPUT TYPE=RADIO NAME="quantum" value="2048"/></td><td align="center"><input type="text" name="drive3"/></td><td align="center"><input type="text" name="size3"/></td></tr> <tr><td rowspan="4" align="center"><img src="hardisk.jpg" height="120pt" width="90pt"/></td><td colspan="3" align="right">Total Gigabytes Purchased</td><td align="center" colspan="2"><input type="text" name="totalsize" readonly="true"/></td></tr> <tr><td colspan="3" align="right">Total Cost of Drives</td><td align="center" colspan="2"><input type="text" name="totalcost" readonly="true"/></td></tr> <tr><td colspan="3" align="right">Discount</td><td align="center" colspan="2"><input type="text" name="discount" readonly="true"/></td></tr> <tr><td colspan="3" align="right">Grand Total</td><td align="center" colspan="2"><input type="text" name="grandtotal" readonly="true"/></td></tr> <tr><td align="center"><input type="submit" value="calculate" onclick="number_of_drives()"/></td><td align="center" colspan="5"><input type="submit" value="clear the form" onclick="clear_form()"/></td></tr> </table> </form> </body> </html> Hi im not good with javavscript so got some code off the net to do some rollovers, however it doesnt validate. can anyone please help me as to why this maybe? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="joho.css" /> <SCRIPT TYPE="text/javascript"> <!-- // copyright 1999 Idocs, Inc. http://www.idocs.com/tags/ // Distribute this script freely, but please keep this // notice with the code. var rollOverArr=new Array(); function setrollover(OverImgSrc,pageImageName) { if (! document.images)return; if (pageImageName == null) pageImageName = document.images[document.images.length-1].name; rollOverArr[pageImageName]=new Object; rollOverArr[pageImageName].overImg = new Image; rollOverArr[pageImageName].overImg.src=OverImgSrc; } function rollover(pageImageName) { if (! document.images)return; if (! rollOverArr[pageImageName])return; if (! rollOverArr[pageImageName].outImg) { rollOverArr[pageImageName].outImg = new Image; rollOverArr[pageImageName].outImg.src = document.images[pageImageName].src; } document.images[pageImageName].src=rollOverArr[pageImageName].overImg.src; } function rollout(pageImageName) { if (! document.images)return; if (! rollOverArr[pageImageName])return; document.images[pageImageName].src=rollOverArr[pageImageName].outImg.src; } //--> </head> <body> <div id="wrapper"> <div id="contentwrapper"> <div id="col1"> <ul> <li><A HREF="home.html" onMouseOver = "rollover('home')" onMouseOut = "rollout('home')" ><img src="menu/row1sq1_home_OP.png" border="0" alt="Home" NAME="home"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row1sq1_home_RO.png"); //--> </SCRIPT></li> <li><img src="menu/row2sq1_OP.png" alt="2"/></li> <li><A HREF="illustrations.html" onMouseOver = "rollover('illustrations')" onMouseOut = "rollout('illustrations')" ><img src="menu/row3sq1_illustrations_OP.png" border="0" alt="illustrations" NAME="illustrations"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row3sq1_illustrations_RO.png"); //--> </SCRIPT></li> <li><img src="menu/row4sq1_OP.png" alt="4"/></li> </ul> </div> <div id="col2"> <ul> <li><img src="menu/row1sq2_OP.png" alt="1"/></li> <li><img src="menu/row2sq2_OP.png" alt="2"/></li> <li><img src="menu/row3sq2_OP.png" alt="3"/></li> <li><A HREF="portraits.html" onMouseOver = "rollover('portraits')" onMouseOut = "rollout('portraits')" ><img src="menu/row4sq2_portraits_OP.png" border="0" alt="portraits" NAME="portraits"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row4sq2_portraits_RO.png"); //--> </SCRIPT></li> </ul> </div> <div id="col3"> <ul> <li><A HREF="about.html" onMouseOver = "rollover('about')" onMouseOut = "rollout('about')" ><img src="menu/row1sq3_about_OP.png" border="0" alt="About" NAME="about"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row1sq3_about_RO.png"); //--> </SCRIPT></li> <li><A HREF="cards.html" onMouseOver = "rollover('cards')" onMouseOut = "rollout('cards')" ><img src="menu/row2sq3_cards_OP.png" border="0" alt="cards" NAME="cards"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row2sq3_cards_RO.png"); //--> </SCRIPT></li> <li><img src="menu/row3sq3_squeak_OP.png" border="0" alt="1"/></li> <li><A HREF="contact.html" onMouseOver = "rollover('contact')" onMouseOut = "rollout('contact')" ><img src="menu/row4sq3_contact_OP.png" border="0" alt="contact" NAME="contact"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row4sq3_contact_RO.png"); //--> </SCRIPT></li> </ul> </div> <div id="col4"> <ul> <li><img src="menu/row1sq4_OP.png" alt="1"/></li> <li><img src="menu/row2sq4_OP.png" alt="2"/></li> <li><A HREF="weddings.html" onMouseOver = "rollover('weddings')" onMouseOut = "rollout('weddings')" ><img src="menu/row3sq4_wedding_OP.png" border="0" alt="weddings" NAME="weddings"/></a><SCRIPT TYPE="text/javascript"> <!-- setrollover("rollovers/row3sq4_wedding_RO.png"); //--> </SCRIPT></li> <li><img src="menu/row4sq4_OP.png" alt="4"/></li> </ul> </div> </div> </div> </body> </html> thank Q C Hi everyone, Would any of you know a cross-platform way to validate XML against XSD in JavaScript? All examples found online use MSXML, which is only available under Windows/IE. Using remote web-services is not a option, since the script should be able to run online. Cheers, Vit Code: <img class="border" alt="googtatic_map" src="http://maps.google.com/maps/api/staticmap?center=51.454863,0.011673&zoom=13&markers=United+Reformed+Church,+111+Burnt+Ash+Road,++Lee,+London+SE12+8RG,+UK&size=250x250&sensor=true" /> I have the above code and it is not validating with the w3c validation for XHTML it has thrown up 8 errors and 14 warnings. Should I ignore them or what? As I do like my code to validate. Hi Folks I am trying to write a js that validates a form with two text inputs. The two inputs a 'D_techA' and 'D_techB'. I just want to add up (sum) the two input fields (which must be positive numbers) and make sure that they add up to exactly 100 (not more and not less). If they do not add up to 100, then an alert should pop up that says "The two values must add up to exactly 100." I have tried and tried to write a js that does this validation (looking at numerous validation scripts posted in this forum and elsewhere) and I just cannot seem to make it work. I would very much appreciate any suggestions! Thanks! The html code for my very simple form is: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <label>Investment in Tech A <input name="D_techA" type="text" id="D_techA" /> </label> <label>Investment in Tech B <input name="D_techB" type="text" id="D_techB" /> </label> <p> <input name="Submit" type="submit"/> </p> </form> </body> </html> Hello all, I am pretty new to javascript and could use some help. I am validating a page (image attached) to make sure that total hours entered do not exceed the allocated amount, which is stored in the database. I have already validated to make sure that they enter a number and that it is not greater than 8. Could some one help me with the rest? thanks so much, Joe Code: var returncode = true var inputs = document.getElementsByTagName("INPUT") for(var x=0; x<inputs.length; x++) { if(inputs[x].type =='text' && isNaN(inputs[x].value)) { document.getElementById("hourserror").style.display = "block"; inputs[x].style.backgroundColor = '#FFCCCC'; returncode = false; } if(inputs[x].value > 8) { document.getElementById("totalerror").style.display = "block"; inputs[x].style.backgroundColor = '#FFCCCC'; returncode = false; } } return returncode; Hi Guys, I use this code to validate e-mail addresses: PHP Code: // checks if the e-mail address is valid var emailPat = /^(".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/; var matchArray = formSignup.txtEmail.value.match(emailPat); if (matchArray == null) { alert("Your email address seems incorrect. Please try again (check the '@' and '.'s in the e-mail address)"); return false; } What i noticed today, is if a customer registers with an e-mail like: something.something@hotmail.com the first dot throws up the error, i'm not to great on regex lol any help would be appreciated thanks guys Graham I managed to create the form that asks you to type in the information but I'm having some difficulty trying to figure out the alert to say "Thank you " after you have everything filled in and then hitting the button. my code is Code: <HTML> <HEAD> <TITLE> Form Validation Example </TITLE> <SCRIPT LANGUAGE="JavaScript"> function validatePersonalInfo(){ var _first = document.info.fname.value; var _city = document.info.city.value; var _phone = document.info.phone.value; if(_first.toString() == ""){alert("Please enter a first name.");} if(_city.toString() == ""){alert("Please enter your city.");} if(_phone.toString() == ""){alert("Please enter your phone number.");} var phoneInput = document.info.phone.value; var validPhone = false; var validCity = false; if(checkCity == true){ validCity = true; } else{ if(!checkPhone(phoneInput)){ alert("Phone number is invalid." + validPhone); } else{ validPhone = true; } if(validCity && validPhone){ alert("Your form has been verified"); } } } function checkPhone(str){ var regexp = /^(\d{10}|\d{3}-\d{3}-\d{4}|\(\d{3}\)\d{3}-\d{4})$/; return regexp.test(str); } function checkNum(length){ var cityLet = parseInt(cityEntry, 10); if (document.info.city.value.length == length){ if(cityLet != 0 && isNaN(cityLet) == false){ return true; } else { return false; } } else { return false; } } </script> </head> <body> <p> <form name="info" action="" method="post"> <table> <tr><td align="left">First Name:</td> <td align="left"> <input type="text" name="fname" size=15> </td> </tr> <br> </tr> <br> <tr> <td align="left">City:</td> <td align="left"> <input type="text" name="city" size=15> </td> </tr> <br> <tr><td align="left">phone</td> <td align="left"> <input type="text" name="phone" size=20></td> </tr> <br> </tr> <br> </table> <center> <input type="button" value="Submit" onClick="validatePersonalInfo()"> </center> </form> </body> </html> the help is greatly appreciated Hi guys! I have tried numerous attempts in getting the Address field to work (i.e. validated). I want it to accept letters, numbers, spaces and commas! However, it won't let me! Below is the code I have provided. Code: function validateAddress(fld) { var error = ""; var illegalChars = /[\W_]/; // } else if (illegalChars.test(fld.value)) { fld.style.background = 'Yellow'; error = "Your Billing address contains illegal characters!\n"; } else { fld.style.background = 'White'; } return error; } Thanks a lot! Hi guys my friend has created a game where there are four boxes each numbered from one to four. When you click on these boxes you either get a tick or a cross. In every turn 3 boxes will have ticks and one will have a cross and the aim is to get as many ticks as possible (each tick gets you a point and when you come across a cross your points are all deleted). Anyway i was wondering if theres a way to guess which box will have a cross beforehand. He claims its random but i wanted to make sure. heres the javascript: var spath; var failbox; var score; var pushnumber; var clickedEl; var clickedElT; var waitEvent = 1; function losegameget() { waitEvent = 1; $(".games3of4 > .box > div").each(function (boxli) { jQuery(this).removeClass("check"); jQuery(this).removeClass("check2"); jQuery(this).removeClass("heart"); jQuery(this).removeClass("heart2") }); jQuery(".savegame").css("visibility", "hidden"); $(".asama").find("span").html("0"); jQuery(clickedEl).removeClass("heart"); jQuery(clickedEl).removeClass("heart2"); $(".losebox").css("display", "block"); $(".box").css("display", "none"); jQuery.get("/game1of3"); jQuery.get("/game1of3?score=1", function (json) { var jsonall; eval("jsonall = " + json + ";"); jQuery("#scoreliste").html(""); for (var i = 0; i < jsonall.length; i++) { jQuery("#scoreliste").append(jQuery('<li><div class="order">' + (i + 1) + "</div> " + jsonall[i]["username"] + " <span>(" + jsonall[i]["score"] + ")</span></li>")) } }); } function gameget() { var dd = $(".asama").find("span").text(); if (dd == "0") { $(".asama").find("span").text(0); } score = eval($(".asama").find("span").text()); $(".asama").find("span").empty().html(score + 1); $(".games3of4 > .box > div").each(function (boxli) { jQuery(this).removeClass("check"); jQuery(this).removeClass("check2"); }); waitEvent = 1; } function wgame() { waitEvent = 0; $(".games3of4 > .box > div").each(function (a) { jQuery(this).removeClass("check"); jQuery(this).removeClass("check2"); }); if (parseInt(jQuery(clickedEl).attr("rel")) == 1 || parseInt(jQuery(clickedEl).attr("rel")) == 2) { jQuery(clickedEl).addClass("check") } if (parseInt(jQuery(clickedEl).attr("rel")) == 3 || parseInt(jQuery(clickedEl).attr("rel")) == 4) { jQuery(clickedEl).addClass("check2") } setTimeout("gameget();", 200); } function losegame() { waitEvent = 0; $(".games3of4 > .box > div").each(function (a) { jQuery(this).removeClass("check"); jQuery(this).removeClass("check2"); jQuery(this).removeClass("heart"); jQuery(this).removeClass("heart2"); }); if (parseInt(jQuery(clickedEl).attr("rel")) == 1 || parseInt(jQuery(clickedEl).attr("rel")) == 2) { jQuery(clickedEl).addClass("heart"); } if (parseInt(jQuery(clickedEl).attr("rel")) == 3 || parseInt(jQuery(clickedEl).attr("rel")) == 4) { jQuery(clickedEl).addClass("heart2"); } setTimeout("losegameget();", 400); } function ifagain() { jQuery(".box").hide(); jQuery(".savegame").hide(); jQuery(".asama").hide(); jQuery("#againcall").show(); jQuery(".yes").click(function () { jQuery.get("/game1of3?start=1", function () { jQuery(".box").show(); jQuery("#againcall").hide(); jQuery(".savegame").css("visibility", "visible"); jQuery(".asama").show(); }) }) } function playSound(a) {} jQuery.jQueryRandom = 0; jQuery.extend(jQuery.expr[":"], { random: function (c, d, b, e) { if (d == 0) { jQuery.jQueryRandom = Math.floor(Math.random() * e.length) } return d == jQuery.jQueryRandom; } }); function countGet() { jQuery.get("/game1of3?count=1", function (a) { jQuery("#defa").html(a + " Defa Oynandı<br />"); }) } $(document).ready(function () { setInterval("countGet();", 20000); jQuery(".savegame").click(function () { if (confirm("Puanınızı kaydetmek istediğinizden emin misiniz ?")) { jQuery.get("/game1of3?save=1", function () { jQuery(".box").hide(); jQuery("#saved").show(); jQuery(".boxaga").show(); jQuery(".savegame").css("visibility", "hidden"); $(".highpoint").find("b").html($(".asama").find("span").text()); $(".asama").find("span").html("0"); }) } }); z = 0; $(".games3of4 > .box > div").each(function (boxli) { $(this).click(function () { if (waitEvent) { clickedEl = this; clickedElT = jQuery(this).attr("rel"); jQuery.get("/game1of3?res=" + jQuery(this).attr("rel"), function (data) { if (data == 'umustbelogin') { window.location.href = '/uye/giris?&redirect_to=/oyun'; } else { var r; r = (data.indexOf("true") != -1); } if (r) { wgame(); } else { losegame(); } }) } }); }); $(".try").click(function () { $(".losebox").css("display", "none"); $(".box").css("display", "block"); jQuery(".savegame").css("visibility", "visible"); }); $(".try2").click(function () { $(".boxaga").css("display", "none"); $(".box").css("display", "block"); jQuery("#saved").hide(); jQuery(".savegame").css("visibility", "visible"); }); $.playgame = function (kcode) { score = eval($(".score").find("span").text()); if (kcode == 49) { pushnumber = 1 } if (kcode == 50) { pushnumber = 2 } if (kcode == 51) { pushnumber = 3 } if (kcode == 52) { pushnumber = 4 } clickedEl = $(".gamecontent li")[pushnumber - 1]; clickedElT = pushnumber; jQuery.get("/game1of3?res=" + pushnumber, function (data) { score = eval($(".score").find("span").text()); var r = eval(data); if (r) { wgame(); } else { losegame(); } }) }; jQuery.get("/game1of3"); }); cheers! Hi guys, as you can see i am newbie.. So ive been working with javascipt and html for about 2 days now. What im trying to do it make a really annoying website kind of like www.mudkipz.ws [go at your own risk], the site is a youtube video of mudkip pokemon that are really annoying they just say Mud-kip for about 9 minutes.. once you try to exit, messages pop up saying "Mud" And "Kip" After Clicking "ok" Its a Loop That goes on for ever! im trying to make something like this on dreamweaver but i have very little experience! Does anyone know how i could be able to make it so it can say [ "hahah i got you!" | |"Only way to exit is by going to this link" | | "Link" | |___________[ok]____________________ | Edit: I got the exit pop up message to work, now i just need the loop code! Any idea of how to put a link in the exit pop up message? Hi there, I'm sure someone can help me with this simple fix. I am putting a site together for a friend and I found a Javascript code that I'm using which basically causes an image to enlarge on mouse rollover. The website, which I just started, is: Home 2 What I'm trying to do is get the larger image to appear a little more to the right than it currently does, so it is not right on top of the thumbnails. I hope someone can tell me what code (and where) I need to add to accomplish this. I'm quite new at this so I really need specific instruction. Thanks in advance for your help! Here is the code for the onmouseover routine: Code: <head> <script language="JavaScript"> function showlargeimage(imgshow) {document.getElementById('image').src=imgshow;} function showlargeimage(imgshow) {document.getElementById('image').src=imgshow; document.getElementById('image').style.display='block'; } </script> </head> <body> <TABLE> <TR> <TD> <!--THUMBNAILS--> <img src="thumbnail1.jpg" onmouseover=showlargeimage('image1.jpg')><br> <br> <img src="thumbnail2.jpg" onmouseover=showlargeimage('image2.jpg')><br> <br> <img src="thumbnail3.jpg" onmouseover=showlargeimage('image3.jpg')><br> <br> <img src="thumbnail4.jpg" onmouseover=showlargeimage('image4.jpg')><br> <br> <img src="thumbnail5.jpg" onmouseover=showlargeimage('image5.jpg')><br> <br> </TD> <TD> <!--image SCREEN--> <img src='#' id='image'> <img src='#' id='image' style='display:none'> </TD> </TR> </TABLE> </body> |