HTML - Form Validation Javascript
have a form.. has certain input fileds like - sptn, rptn, mps, mpr etc
am trying to validate all entries to be entirely numeric and within range if (sptn>0 && sptn<65535 && rp>0 && rp<65535 && rptn>0 && rptn<65535 && mps>0 && mps<65535 && mpr>0 && mpr<65535) alert("all values ok"); problem is => this works even if i enter any of the values as =-=-=- or ./,/.,-= or any other junk characters but this snippet works fine if (spn>99 && spn<=999 && rpn>99 && rpn<=999) alert("ok"); please advise Similar TutorialsHi I am using a CGI-BIN script to submit an html form to an email address. I am wondering how i can make field in this html form "required"?? Would be thankful if someone could point me in the right direction. Could someone please advise how to make a singular field validated before sending via smtp, through a Content Management system. I do not have access to the CSS side of things and am hoping this will help my own knowledge banks. The RTE does accept some types of Javascrpt but a resolution in this would ahve to be very simple. Appreciated any help given, thanks all. Tom When trying to validate more then one text box, the code ignores the first set of code and moves straight to the second :\ why does it do that? HTML Code: <script type="text/javascript"> <!-- function validate_form ( ) { valid = true; if ( document.MyFrom.fname.value == "" ) { alert ( "Please fill in the 'Your Name' box." ); valid = false; } return valid; } function validate_form ( ) { valid = true; if ( document.MyFrom.lname.value == "" ) { alert ( "Please fill in the 'Youlr Name' box." ); valid = false; } return valid; } </script> Hi everyone, does anyone know how to make it so, on a form, when a person inputs their phone number it wont accept anything less than 11 numbers and anything more than 11 numbers? Thanks Hi guys i have a form that has name , email , country (drop down list ) , state , city , address , phone . I would like to validate the form so that when a space is left empty for example the "name" space is left empty a message box alerts them I recently hired a freelancer to validate all the code for my Wordpress e-commerce website (http://www.projectdisobey.com/disobeyclothing) He told me that he had finished validating everything, but when I tested each page out using the validation service at http://validator.w3.org/, I came across a whole load of validation errors (http://imageshack.us/f/836/validationerrors.jpg/). I notified the freelancer of this and his reply was: "The errors left are because of javascript in the source code. The website http://validator.w3.org checks the source code of the page and gives errors on javascript because the checker is not for Javascript. It checks it as a html/css and gives errors." Since I am no expert in this field, can anybody tell me from glancing over the list of validation errors (http://imageshack.us/f/836/validationerrors.jpg/) whether he is speaking the truth or not? If any of the errors have nothing to do with Javascript and are easy to resolve, would anybody mind advising me how to do so? I'd be extremely appreciative. Thanks guys... Hi Ya, I am trying to validate the telephone number for a form. I would really like some help. You see when i leave the telephone field blank the code error message comes up telling me that i cant leave that field blank. When i then put in illegal characters it says that i used illegal characters but instead of clearing the feild,allowing me to type the correct phone number and then moving onto the getradio if statement it goes to receipt page when the submit button is clicked instead of doing the validate checks first and then moving onto the receipt.html page. This is the problem area. Code: if (form.phone.value == "") { alert("Please enter your telephone number for shipping Information."); form.phone.focus(); return (false); } else { validate(); } if (getRadio("pay") == null) { alert("Please choose a payment method."); return (false); } return (true); } //--></script> <script language="javascript"> function validate() { if (isNaN(parseInt(this.value))) { alert("The phone number contains illegal characters."); form.phone.focus(); return (false); } } //--></script> The below code is for the form. Code: <FORM name="information" action="..\..\Cars\GT\receipt.html" method="get" onSubmit=" return form_Validator(this)"> <!-- Tells the button what action to take --> The below code is the full validation check function Code: <!-- This is used to validate the radio buttons to make sure that one of those options are pressed --> <script language="javascript"> function getRadio(radioName){ var inputs = document.getElementsByTagName('input'); var ret = null; for(var i = 0; i < inputs.length; i++){ if(inputs[i].type == 'radio' && (inputs[i].name == radioName || inputs[i].id == radioName) && inputs[i].checked){ ret = inputs[i].value; } } return ret; } <!-- This is used to validate the text boxes to make sure that an item is written into it --> <!-- I f the next box remains empty an error message appears --> function form_Validator(form) { if (form.first_name.value == "") { alert("Please enter your first name for shipping Information."); form.first_name.focus(); return (false); } if (form.last_name.value == "") { alert("Please enter your last name for shipping Information."); form.last_name.focus(); return (false); } if (form.address.value == "") { alert("Please enter your address for shipping Information."); form.address.focus(); return (false); } if (form.acode.value == "") { alert("Please enter the area code for shipping Information."); form.acode.focus(); return (false); } if (form.phone.value == "") { alert("Please enter your telephone number for shipping Information."); form.phone.focus(); return (false); } else { validate(); } if (getRadio("pay") == null) { alert("Please choose a payment method."); return (false); } return (true); } //--></script> <script language="javascript"> function validate() { if (isNaN(parseInt(this.value))) { alert("The phone number contains illegal characters."); form.phone.focus(); return (false); } } //--></script> </head> Hi, I'm new to the forums, so if this is in the wrong place i apologize. I've been thrown into the fire at work to develop some of the website and I'm absolutely stuck on one of my forms. It's submitting name, email and a couple checkboxes. I need the script to verify that the fields are not blank, the email field is a valid address, and the checkboxes are checked. Any ideas? <body> <script> function Do_it() { if(document.Form1.FirstName.value == "") { errormessage += "\n\nPlease fill out your first name."; } if(document.Form1.LastName.value == "") { errormessage += "\n\nPlease fill out your last name."; } if(document.Form1.email.value == "") { errormessage += "\n\nPlease fill out your email address."; } if(document.Form1.checkbox1.value == "") { errormessage += "\n\nPlease verify you are 13 or older."; } if(document.Form1.checkbox2.value == "") { errormessage += "\n\nPlease verify you have read and agree to the Privacy Policy."; } } return false; else return true; } </script> <div id="Layer1"> <div align="center"><img src="bg.jpg" width="800" height="600" /> </div> <div id="Layer13"> <form action="feedback.php" method="post" name="Form1" onSubmit="return Do_it()"> <table width="100%" height="100%" border="0" cellpadding="5" cellspacing="2" style="width: 445px; height: 100%;"> <tr> <td nowrap="nowrap"><div align="right"> First Name:</div></td> <td><input class="dsR2" type="text" name="FirstName" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> Last Name:</div></td> <td><input class="dsR3" type="text" name="LastName" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> E-mail:</div></td> <td><input class="dsR4" type="text" name="email" size="43" /></td> </tr> <tr> <td nowrap="nowrap"><div align="right"> <input class="dsR1" type="checkbox" name="checkbox1" /> </div></td> <td> I am over 13 years of age. </td> </tr> <tr> <td nowrap="nowrap"><div align="right"> <input class="dsR1" type="checkbox" name="checkbox2" /> </div></td> <td>I read and agree to the <a href="terms.html" target="_blank">Privacy Policy </a></td> </tr> <tr> <td colspan="2" nowrap="nowrap"><div align="center"> <p> <input name="submit" type="submit" class="dsR1" value="Submit" /> </p> </div></td> </tr> <tr> <td colspan="2" valign="top"><div align="center"><span class="style1"> </span> <div id="Layer3"> <div align="center"><span class="style2">We respect your privacy and understand the value of protecting personally identifiable information, we pledge not to sell any personally identifiable information to any third party</span>.</div> </div> </div></td> </tr> </table> </form> </div> </body> I have a form that i want to ensure is filled out correctly before the user is able to proceed. http://chimp.cc/start.htm If the user fails to fill out the terms and conditions box with a "Yes"when the user clicks submit, i want a message to pop up to tell them to complete it. and to return the user to that field for completion. I honestly have no idea how to do this, can someone please help me. I have attached the source code too. Cheers Andy Hi I realy need help with my coursework! I am really bad with HTML and forms I want my form to not send to the email address i have specified unless all the fields in the form are full, this wont be a problem with the select boxes and the radio buttons as they are already selected. I only need to validate the text field and area. This is my form so far ... 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=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; } .style1 {color: #FFFFFF} .style2 {font-size: 14px} --> </style> <form action="script.cgi" onSubmit="return checkform()"> <script> function checkform() { if (value of textfield is null) { alert('Please insert your name'); return false; } else if(value of textarea is null) { alert('Please enter your comments for this website'); return false; } return true; } </head> <body> <form action="emailformhandler.php" method="post" name="Feedback Form" class="style2" id="Feedback Form"> <p align="left">Your Name <span class="style1"> .................................................</span> <input type="text" name="textfield" size="30" maxlength="100" /> </p> <p>Where do you live? <span class="style1">....................................</span> <select name="select" size="1"> <option>Dunstable</option> <option>Luton</option> <option>Houghton Regis</option> <option>Other</option> </select> </p> <p>How did you find out about this website? <span class="style1">....</span> <select name="select2" size="1"> <option>Your Teacher</option> <option>Mr Holmes</option> <option>Word Of Mouth</option> <option>SSCO</option> <option>Search Engine</option> <option>Other</option> </select> </p> <p><img src="http://himeshs.co.uk/ICT/untitled.GIF" width="181" height="56" /><span class="style1">.......................</span> <textarea name="textarea" cols="30" rows="5"></textarea> </p> <p> What is your rating of this website <span class="style1">.............</span> <input name="radiobutton" type="radio" value="radiobutton" checked /> Excellent <input name="radiobutton" type="radio" value="radiobutton" /> Good <input name="radiobutton" type="radio" value="radiobutton" /> Average <input name="radiobutton" type="radio" value="radiobutton" /> Poor</p> <p> <input type="submit" name="Submit" value="Submit Form" /> <input type="reset" name="Submit2" value="Clear Form" /> </p> </form> </body> </html> I would appreciate any help i could get and dont forget im a noob at forms nd stuff like that lol Thanks! Himesh If you look here at http://www.babyjai.com/quote.php you will see the form validates before it tries to push it thru, how come when you look at http://dinasky.me/contact.php it doesnt do it, it just pushed it thru, i cannot figure it out! Hello, I have an trouble with an html form validation called in a div with a javascript code for form validation. I have a main page in which I have a named div(workplace) where I call a html form page. Once the form page is called in the "workplace" div, the form is working, I can submit the entries to the database but the javascript validation doesn't work. But if I open the form in a decicated browser window then the javascript form validation works. I want to use div because everywhere I'm reading that "frames" is the devil and I should use div tag instead. Where could be my trouble? Your help is appreciated. Below there are my main page & form page. Main page html code Code: <html> <head> <script type="text/javascript" src="../library/ajax_navagation.js"></script> <title>My Web page</title> </head> <body> <div id="Menu"> <p><a href="javascript:void(0)" onClick="open_url('../admin/adduser.html', 'workplace');">Add user</a></p> <p><a href="javascript:void(0)" onClick="open_url('../admin/showusers.php', 'workplace');">Show users</a></p> </div> <div id="workplace"></div> </body> </html> Add user form with javascript for form validation Code: <script type="text/javascript"> <!-- function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } } //--> </script> Add new user <form action="../ui/admin/adduser.php" method="post" name=adduser onSubmit="MM_validateForm('username','','R','password','','R',);return document.MM_returnValue"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">Username</td> <td><input name="username" type="text" id="username"> *</td> </tr> <tr> <td width="100">Password</td> <td><input name="password" type="text" id="password"> *</td> <tr> <td width="100"> </td> <td> </td> </tr> <tr> <td width="100"> </td> <td><input name="add" type="submit" id="add" value="Add New User" ></td> </tr> </table> </form> I'm using Godaddy's gdform.php form mailer for my forms. The forms work perfectly except the validation. I need the visitors to fill in the fields and then submit the information to my email, but the problem is that everyone can submitt even if he doesn't fill in the form. I want all of the fileds to be required. Is there something wrong with the code ? Here it is : <form action="/gdform.php" method="post"> <table align="center"> <input type="hidden" name="subject" value="Form Submission"> <input type="hidden" name="redirect" value="/Add/thankmes.html"> <input type="hidden" name="required" value="YourName, Email, description"> <tr> <td><p><font color=WHITE font size=4>Your Name:</p> </font></td> <td align=center height=50><p><input type="text" name="YourName" size="52"/></p></td> </tr> <tr> <td><p><font color=WHITE font size=4>Your E-mail:</p> </font></td> <td height=50><p><input type="text" name="Email" size="52"/></p></td> </tr> <tr> <td><p><font color=WHITE font size=4>Your Message:</p> </font></td> <td><br><p><textarea name="description" cols="40" rows="5"> </textarea></p></td> </tr> <tr> <td><input type="submit" name="submit" value="Send"/></td> </tr> </table> </form> <form class="contact" method="post" action="mail.php#contact" /> I've reduced the errors down to two but I'm stuck on fixing these final connected errors relating to the form apparently not being open, but it is! Could someone please see below and tell me what they think? http://validator.w3.org/check?uri=ht...alidator%2F1.2 Thank you. Hi. My entire site is 100% XHTML1.1. Except for some new code I added which causes errors in validation. the code is HTML Code: <a href="http://babelfish.altavista.com/babelfish/" onclick="window.open('http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=en_it&url='+encodeURIComponent(location.href));return false;" title="Translate to Italian"><img title="Italian" src="http://geekimo.com/licons/it.png" alt="Italian" /></a> I understand maybe CDATA islands can help with this? or making it external? but I have no idea how to do that with it having html code in there too.. I don't know if you can surround it in CDATA tags. There are other lines of code too, exactly the same except have different languages. Any help would be awesome! I am trying to make my contact page pass the W3C validation test. I have tried putting the form names (your name, your email and subject) in a p class with a defined font family and size because I think this is what W3C is telling me what to do but I still get lots of errors.. This is my form: HTML Code: <form method="post" action="contact.php">your name:<br /> <input type="text" name="name" size="19"><br />your email:<br /> <input type="text" name="email" size="19"><br />subject:<br /> <textarea rows="5" name="message" cols="30"></textarea> <br /> <input type="submit" value="submit" name="submit"> </form> Please can someone shed some light onto this? Is it possible to add some form code to this javascript HTML Code: <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Contact</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="imagetoolbar" content="no"> <meta http-equiv="imagetoolbar" content="false"> <meta name="generator" content="LMSOFT Web Creator Pro, Version:4.0.0.4"> <META NAME="KEYWORDS" CONTENT="Cleaning Contractor Cleaner Coronet Macquarie Park North Ryde Nth Ryde Epping Beecroft Carlingford Parramatta Silverwater Rose Hill"> <META NAME="DESCRIPTION" CONTENT="Coronet Cleaning Services provide a professional cleaning service for Offices, Real Estate, Clubs and Office Buildings in and around Sydney.Areas North Ryde,Maquarie Park,Epping,Beecroft,Carlingford,Parramatta,Silverwater,Rose Hill"> <META NAME="AUTHOR" CONTENT=""> <META NAME="CREATION_DATE" CONTENT=""> <META HTTP-EQUIV="CONTENT-LANGAGE" CONTENT=""> </head> <script type="text/javascript" src="./lmpres70.js"></script><noscript><br></noscript> <script type="text/javascript" src="./menumodel002.js"></script><noscript><br></noscript> <body onresize=PosPage(2,5,1.000000,1.000000); bgcolor="#ffffff" > <DIV STYLE="position:absolute; visibility:hidden; left:0; top:0; width:0; height:0;"> [<a href='./index.html'>./index.html</a>]<br> [<a href='./company.html'>./company.html</a>]<br> [<a href='./about_us.html'>./about_us.html</a>]<br> [<a href='./contact.html'>./contact.html</a>]<br> [<a href='http://www.lmsoft.com/'>Web Creator</a>] [<a href='http://www.lmsoft.com/'>LMSOFT</a>] </DIV> <DIV id=lmwcbackpanel style="visibility:visible;position:absolute;left:0;top:0;width:1280;height:800;clip:rect(0,1280,800,0);"> <DIV id=Page style="visibility:visible;overflow:hidden;position:absolute;z-index:1;left:0;top:0;"> <a name=#anchor_Page></a><IMG id=LMImagePage src="./lmimginv.gif" style="width:1280;height:800;border:0;"> </DIV> <DIV id=Img7 style="visibility:visible;overflow:hidden;position:absolute;z-index:2;left:0;top:-1;"> <a name=#anchor_Img7></a> <IMG id=LMImageImg7 src="./images/~gen_img7_10.jpg" style="width:1280;height:600;border:0;"></DIV> <DIV id=Img2 style="visibility:visible;overflow:hidden;position:absolute;z-index:3;left:71;top:90;"> <a name=#anchor_Img2></a> <IMG id=LMImageImg2 src="./images/~gen_img2_00.jpg" style="width:820;height:620;border:0;"></DIV> <DIV id=GBackground style="visibility:visible;overflow:hidden;position:absolute;z-index:4;left:0;top:0;width:0;height:0;"> <a name=#anchor_GBackground></a> </DIV> <DIV id=GLeft style="visibility:visible;overflow:hidden;position:absolute;z-index:5;left:0;top:0;width:0;height:0;"> <a name=#anchor_GLeft></a> </DIV> <DIV id=Img6 style="visibility:visible;overflow:hidden;position:absolute;z-index:6;left:86;top:118;"> <a name=#anchor_Img6></a> <IMG id=LMImageImg6 src="./images/~gen_img2_20.jpg" style="width:780;height:30;border:0;"></DIV> <DIV id=Img9 style="visibility:visible;overflow:hidden;position:absolute;z-index:8;left:524;top:118;"> <a name=#anchor_Img9></a> <IMG id=LMImageImg9 src="./images/~gen_img9_00.jpg" style="width:1;height:30;border:0;"></DIV> <DIV id=Img5 style="visibility:visible;overflow:hidden;position:absolute;z-index:9;left:306;top:118;"> <a name=#anchor_Img5></a> <IMG id=LMImageImg5 src="./images/~gen_img9_00.jpg" style="width:1;height:30;border:0;"></DIV> <DIV id=Img21 style="visibility:visible;overflow:hidden;position:absolute;z-index:10;left:195;top:118;"> <a name=#anchor_Img21></a> <IMG id=LMImageImg21 src="./images/~gen_img9_00.jpg" style="width:1;height:30;border:0;"></DIV> <DIV id=Img22 style="visibility:visible;overflow:hidden;position:absolute;z-index:11;left:415;top:118;"> <a name=#anchor_Img22></a> <IMG id=LMImageImg22 src="./images/~gen_img9_00.jpg" style="width:1;height:30;border:0;"></DIV> <DIV id=GMenu style="visibility:visible;overflow:hidden;position:absolute;z-index:12;left:0;top:0;width:0;height:0;"> <a name=#anchor_GMenu></a> </DIV> <DIV id=Text17 style="visibility:hidden;position:absolute;z-index:13;left:495;top:175;"> <a name=#anchor_Text17></a> <DIV id=LMTxtText17 style="visibility:inherit;position:relative;left:5;top:5;width:186;height:57;"> <font face='Arial'> <div align="left"><font face="Times New Roman" color="#ffffff" size="4"><span style=" font-size:14pt"><b><br /> </b></span></font></div> <div align="left"><font face="Arial" color="#ffffff" size="5"><span style=" font-size:20pt"><b> </b></span></font><font face="Arial" color="#808080" size="5"><span style=" font-size:20pt"><b>Contact</b></span></font></div> </font> </DIV> </DIV> <DIV id=Img4 style="visibility:visible;overflow:hidden;position:absolute;z-index:14;left:454;top:234;"> <a name=#anchor_Img4></a> <IMG id=LMImageImg4 src="./images/~gen_img3_00.jpg" style="width:400;height:1;border:0;"></DIV> <DIV id=GCenter style="visibility:visible;overflow:hidden;position:absolute;z-index:15;left:0;top:0;width:0;height:0;"> <a name=#anchor_GCenter></a> </DIV> <DIV id=GForm style="visibility:visible;overflow:hidden;position:absolute;z-index:16;left:0;top:0;width:0;height:0;"> <a name=#anchor_GForm></a> </DIV> <DIV id=Text1 style="visibility:hidden;position:absolute;z-index:17;left:527;top:92;"> <a name=#anchor_Text1></a> <DIV id=LMTxtText1 style="visibility:inherit;position:relative;left:15;top:15;width:349;height:53;"> <font face='Arial'> <p style="margin-left:0mm; margin-right:0mm; text-indent:0mm; margin-top:1.76mm; margin-bottom:1.76mm;"><font face="Verdana" color="#ffffff"><span style=" font-size:12pt">Call</span></font><font face="Verdana"><span style=" font-size:12pt"> </span></font><font face="Verdana" size="5"><span style=" font-size:20pt"> </span></font><font face="Arial" size="2"><span style=" font-size:10pt"> </span></font><font face="Times New Roman" color="#ffffff" size="4"><span style=" font-size:14pt">0411 590 735 or 0421 641 653</span></font></p> <div align="left"> </div> </font> </DIV> </DIV> <DIV id=Img8 style="visibility:visible;overflow:hidden;position:absolute;z-index:18;left:86;top:166;"> <a name=#anchor_Img8></a> <IMG id=LMImageImg8 src="./images/cc4.jpg" style="width:352;height:71;border:0;"></DIV> <DIV id=Img10 style="visibility:visible;overflow:hidden;position:absolute;z-index:19;left:471;top:208;"> <a name=#anchor_Img10></a> <IMG id=LMImageImg10 src="./images/cc1.jpg" style="width:31;height:17;border:0;"></DIV> <script type="text/javascript"> //LMSOFT Web Creator Pro, Version:4.0.0.4 //LMSOFT Kernel 70 var LMObjects = new Array(); var pub_home = "./index.html" var objindex=0; var Stretch=2; var Position=5; var ScaleW=1.000000; var ScaleH=1.000000; var fontbase=96.; var isdisplay=false; //--------------------------------------------------------------------------------------------- try { if(isValideBrowser(7.00,5.00)) { InitResources(); //--------------------------------------------------------------------------------------------- LMObjects[objindex++] = LMPage("Page",null,null,null,0); LMObjects[objindex++] = LMImage("Img7",1,0,null,0,null,null,null,null,0); LMObjects[objindex++] = LMImage("Img2",1,0,null,0,null,null,null,null,0); objlist = new Array(); objlist[0] = "Img7"; objlist[1] = "Img2"; LMObjects[objindex++] = LMGroup("GBackground",1,objlist); objlist = new Array(); LMObjects[objindex++] = LMGroup("GLeft",1,objlist); LMObjects[objindex++] = LMImage("Img6",1,0,null,0,null,null,null,null,0); menumodel002Show(86, 118, "GMenu2"); LMObjects[objindex++] = LMImage("Img9",1,0,null,0,null,null,null,null,0); LMObjects[objindex++] = LMImage("Img5",1,0,null,0,null,null,null,null,0); LMObjects[objindex++] = LMImage("Img21",1,0,null,0,null,null,null,null,0); LMObjects[objindex++] = LMImage("Img22",1,0,null,0,null,null,null,null,0); objlist = new Array(); objlist[0] = "Img6"; objlist[1] = "GMenu2"; objlist[2] = "Img9"; objlist[3] = "Img5"; objlist[4] = "Img21"; objlist[5] = "Img22"; LMObjects[objindex++] = LMGroup("GMenu",1,objlist); branchlist = new Array(); LMObjects[objindex++] = LMText("Text17",1,0,null,0,null,branchlist,null,null,5,5,5,5); LMObjects[objindex++] = LMImage("Img4",1,0,null,0,null,null,null,null,0); objlist = new Array(); objlist[0] = "Text17"; objlist[1] = "Img4"; LMObjects[objindex++] = LMGroup("GCenter",1,objlist); objlist = new Array(); LMObjects[objindex++] = LMGroup("GForm",1,objlist); branchlist = new Array(); LMObjects[objindex++] = LMText("Text1",1,0,null,0,null,branchlist,null,null,15,15,15,15); LMObjects[objindex++] = LMImage("Img8",1,0,null,0,null,null,null,null,0); LMObjects[objindex++] = LMImage("Img10",1,0,null,0,null,null,null,null,0); //--------------------------------------------------------------------------------------------- } }catch(e) { alert(e.message); } SetBaseColor(0x3f0,0x3f0,0x7a); if(isdisplay==true) GetDisplayInfo("","",0,"","./"); else LMObjectAnimate(Stretch,Position,ScaleW,ScaleH); </script><noscript><br></noscript> </DIV> </body> </html> Why is this not working? (when i search hiscores it works, but not Google) Quote: <html> <head> <title></title> <script type="text/javascript"> function action( inStr ){ var a = "http://hiscore.runescape.com/hiscorepersonal.ws?user1="; var b = "http://www.google.com/search?q="; var c = document.sform; if( inStr == "h" ){ c.action = a; }else if( inStr == "g" ){ c.action = b; }else{ alert("I don't know where you want to go!!!"); } c.submit(); return true; } </script> </head> <body> <form method="get" action="#" target="_blank" name="sform"> <input name="user1" size="12" maxlength="12" value="" style="font-size: 10px;" type="text"> </form> <br> <input type="button" name="btnH" value="Hiscores" style="font-size: 10px;" onclick="action('h');"> <input type="button" name="btnG" value="Google" style="font-size:10px" onclick="action('g');"> </body> </html> |