JavaScript - Javascript - How To Login On Pressing Enter?
HI,
I have a website with a Login page (no username only password required), but at the moment it only works when you click Login after entering the password. How could i make it so that pressing Enter will do the same???? here is the full index.html file 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>Please login</title> <link rel="stylesheet" href="css/login.css" type="text/css" media="all" /> <!--[if IE 7]><link rel="stylesheet" href="css/style.ie7.css" type="text/css" media="screen" /><![endif]--> </head> <body> <div id="Main"> <div class="corner TL"></div> <div class="corner TR"></div> <div class="corner BL"></div> <div class="corner BR"></div> <div class="logo"></div> <div class="loginForm"> <form name="login-form"> <script language="javascript"> <!-- /*Change the usename,password and the page to redirect the user to to suit your own site*/ function login(form) { if (form.password.value=="england2000") { location="/en" } else { alert("Sorry Invalid Password") } } //--> </script> <label>PASSWORD</label> <input class="field" name="password" type="password" /> <input type="button" value="Login" class="loginB" onClick="login(this.form)"> </form> </div> <div style=" clear:both;"></div></div> </body> </html> Similar TutorialsHi, I am facing one problem when i am trying to open the outlook express through javascript. Here i am able to open the outlook express with all the data, but when i press enter on any line of the body if the message, it moves 2 lines. Can any body help me to make it to single spacing. The code i have used is given below. sendemail.js Quote: // JScript File function EmailIt(task,issue_id,emailTO,strTitle,strsubsystem,chkAvailableAll,ddlJob,ddlSystem,ddlTester,ddlPr iority,txtDueDate,ddlAssignedTo,ddlStatus) { //win = window.open("...\\Issues\\HTMLPage3.htm"); var daReferrer = document.referrer; //var task = escape(document.URLUnencoded); //var issue_id = document.URLUnencoded.split("="); var email = emailTO; var title = strTitle; var subsystem = strsubsystem; var availableall = chkAvailableAll; var CustomerJob = ddlJob; var System = ddlSystem; var DueDate = txtDueDate; var AssignedTo = ddlAssignedTo; var Priority = ddlPriority; var Tester = ddlTester; var Status = ddlStatus; var subject = "Issue Task number is " + issue_id + " - " + escape(title) ; var body_message = " Your Assigned Task is.%0D " + escape(task); //+ escape("\n") + " :subsystem ===>"+ subsystem + escape("\n") + " :title ===>" + title + escape("\n") + "available all ===>" +availableall; body_message += escape("\n"); body_message += escape("\n"); body_message += " Customer/Job : " + escape(CustomerJob); body_message += escape("\n"); body_message += " Available For All : " + escape(availableall); body_message += escape("\n"); body_message += " System : " + escape(System); body_message += escape("\n"); body_message += " Sub System : " + escape(subsystem); body_message += escape("\n"); body_message += " Title : " + escape(title); body_message += escape("\n"); body_message += " DueDate : " + escape(DueDate); body_message += escape("\n"); body_message += " AssignedTo : " + escape(AssignedTo); body_message += escape("\n"); body_message += " Priority : " + escape(Priority); body_message += escape("\n"); body_message += " Tester : " + escape(Tester); body_message += escape("\n"); body_message += " Status : " + escape(Status); body_message += escape("\n"); //alert("body_message:--> " + body_message); var mailto_link = 'mailto:'+email+'?subject='+subject+'&body='+body_message; //alert("mailto_link: " + mailto_link); win = window.open(mailto_link); if (win && win.open &&!win.closed) win.close(); //window.history.back(-1); } Can any body please help me to come out this problem. Regards, Vimal kumar srivastava Madhepura,India My problem is the following. I have an editable <div>: <div class='edit' id='divContent' name='divContent' ContentEditable>some text</div> If I press 'enter' two lines are skipped. I know that if I press 'shift+enter' only one line will be skipped. If I check the unformatted code of the contenteditable div, 'enter' gives me <p> and 'shift+enter' gives me <br>, which makes sense because <p> is formatted differently than <br>. So I want to change 'enter' into 'shift+enter' I have already found something to capture and kill 'return' function killReturn() { key = event.keyCode; if (key == 13) return false; } But now for some means to replace the killed 'enter' with 'shift+enter'? Thanks a lot in advance for any advise! Ok Need Help Here. As I post earlier how to detect firefox before let the user in some guys just disable javascript and went in I finding solution i think of it but i dun know the code not sure is it working Script that allow the browser to check weather javascript is ON if not cannot grant access to the page . Another thing is by using a image means when i enter the site it will show a image i will need to click it before it enter the content of the pages i think that a javascript code i seen it somewhere else about months ago. How can I simulate pressing a key in javascript into a specific textfield?
Hey, I've got the following problem: I want to edit this code: <a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.pp"><img src="http://blog.bastian.info/wp-content/uploads/2010/02/facebook-glossy-logo.jpg"></a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> So that after they click the button that triggers the facebook share, 7 seconds after they click it, some text appear and the picture they click disappears. Cheers can anyone help me change this script to add confirmation of finishing the exam when pressing submit button and avoiding that when time is out....and how could i save radio button checked even if page being refreshed it stays checked....thanks in advance. this is the code.... Code: <?php if($_POST['submit']) { print_r($_POST); $aqeel= $_POST['q']; print "a ".$aqeel[2]; exit(0); } ?> <?php //Function to generate/fetch the exam //Example output of the function: $examQuestions = " <label for='q1'>What is your name?</label><input type='text' name='q[1]' id='q1'><br /> Are you:<label for='q2a'>Male</label><input type='radio' name='q[2]' id='q2a' value='male'> or <label for='q2b'>Female</label><input type='radio' name='q[2]' id='q2b' value='female'><br /><input type='text' name='c'> "; //Set a variable in the format: 'h, m, s' for use as the timer paramiters //Sample: $timerLength = '0, 0, 10'; //0 hours, 0 minutes, 10 seconds ?> <html> <head> <script language='javascript' type='text/javascript'> function timerShow(hours, minutes, seconds, init) { if(init === true) { setTimeout("timerTick(" + (hours * 360 + minutes * 60 + seconds) + ")", 1000); } if(hours > 0) { time_left = hours + " hr:" + minutes + " min:" + seconds + " sec"; } else { if(minutes > 0) { time_left = minutes + " min:" + seconds + " sec"; } else { if(seconds > 0) { time_left = seconds + " sec"; } else { document.getElementById("submit").click(); } } } document.getElementById("timer").innerHTML = "Time Remaining: <b style='font-size: 14pt; color:red;'>" + time_left + "</b>"; } function timerTick(seconds) { seconds -= 1; if(seconds > 0) { setTimeout("timerTick(" + seconds + ")", 1000); } hours = (seconds - (seconds % 360)) / 360; seconds -= hours * 360; minutes = (seconds - (seconds % 60)) / 60; seconds -= minutes * 60; timerShow(hours, minutes, seconds, false); } </script> </head> <body> <div> This exam consists of <b><?php echo $num_q; ?></b> questions.<br /><br /> You have <b></b> minutes to complete this exam.<br /><br /> <input type='button' onclick='this.parentNode.style.display = "none"; document.getElementById("exam").style.display = ""; timerShow(<?php echo $timerLength; ?>, true);' value='Start'> </div> <form id='exam' method='post' style='display: none;'> <div id='timer'></div> <?php //output the exam here echo $examQuestions; ?> <input type='submit' value='Finish' name='submit' id='submit'> </form> </body> </html> hey guys im not sure if this is javascript or not, but how do i make this? i only want one username/password to catch spam Hello, I have been working on a website for a while now and have started working on user created accounts for my javascript login. Here is the code for the login: <h3 align="center"> Sign In</h3> <form id="Form1" onsubmit="login()"> <p align="center"> User Name: <input type="text" id="userid"></p> <p align="center"> Password: <input type="password" id="pswrd"></p> <p align="center"><input type="submit" value="Login"/> <input type="reset" value="Cancel"/></p> </form> <script language="javascript"> UNArray=["User1","User2","User3"] PWArray=["Password1","Password2","Password3"] function login(){ for(i=0;i<=UNArray.length;i++){ if(document.getElementById("userid").value==UNArray[i]){ if(document.getElementById("pswrd").value==PWArray[i]){ window.open("Home.html") } } } } Here is the code for the "Create An Account" page: <form id="form1"> Your First Name: <input type="text" name="firstname"> <br/> <br/> Desired Username: <input type="text" name="username"> <br/> <br/> Email (Optional): <input type="text" name="Email"> <br/> <br/> Password: <input type="password" name="password"> <br/> <br/> <input type="submit" value="Submit"> </form> Can Anyone help me with this? Thanks! Hi,Im a student studying web design and I am stuck with my JavaScript Login code. I want my code to be able to log a user in if they have the correct username and password fields.however,if the password or username is wrong i would like to display a message in the label that says 'not valid' if they do not put anything into the username or password field,the label should read 'field cannot be empty.' this is what i have so far.im sure i have done something wrong.thank you in advance function validate() { var login="true"; document.getElementById("lblFnameVal").innerHTML=""; var checkForX = document.getElementById("fname").value; document.getElementById("lblpass").innerHTML=""; var passw = document.getElementById("fpass").value; if(document.getElementById('checkForX').value.length==0) { document.getElementById("lblFnameVal").innerHTML="username cannot be empty"; document.getElementById("lblFnameVal").style.color="red"; login="false"; } else if(document.getElementById('passw').value.length==0) { document.getElementById("lblFnameVal").innerHTML="username cannot be empty"; document.getElementById("lblFnameVal").style.color="red"; login="false"; } else (checkForX != "username" ) { document.getElementById("lblFnameVal").innerHTML="not valid"; document.getElementById("lblFnameVal").style.color="red"; login="false"; } else if(passw !="password") { document.getElementById("lblpass").innerHTML="not valid"; document.getElementById("lblpass").style.color="red"; login="false"; } if(login =="true" ) { document.getElementById("mypassForm").submit() } } Hi, I need some help here- below is the script I'm trying to externalize but whatever I've tried doesn't work (the Login button doesn't nothing when the script is external). Thanks!!! <form name="login" autocomplete="off"> <p>User Name : <input type="text" name="username"></p> <p>Password : <input type="password" name="password"></p> <input type="button" value="Login" name="Submit" align="right" onClick="Login()";> </p> </form> </div> <script language="JavaScript"> function Login(){ var done=0; var username=document.login.username.value; username=username.toLowerCase(); var password=document.login.password.value; password=password.toLowerCase(); if (username=="bruceclements" && password=="berlin") { window.location="users/bruceclements.html"; done=1; } if (username=="free" && password=="java") { window.location="page2.html"; done=1; } if (username=="member3" && password=="password3") { window.location="page3.html"; done=1; } if (done==0) { alert("Invalid login!"); } } </script> Hi, I know nothing about javascript but I was able to handle the instructions to install the login/password featu http://www.javascriptkit.com/script/...ginpass2.shtml works great! however, when someone views the source code, they're able to see what the password is. additionally they can see the url of the page it would take them if they entered the password. how do i protect against this vulnerability? thanks in advance! Hello i need help with a simple single field javascript login form, i am building a small website for I and my classmates. i want it to be able to redirect each user to a specific page when a corresponding passcode is entered, i know its unsafe but we dont plan on keeping valuable information on the site, i dont know about MSQL and dont even wish to use it, the code works at this level but am unable to add users since i dont understand javascript if someone could help me i will be very grateful thanks in advance /*here is the code i got so far*/ <tittle> Enter Passcode to proceed </title> <h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt; color:#00FF00;> </h1> <form name="login"> Passcode: <input type="text" name="userid"/> <input type="button" onclick="check(this.form)" value="Login"/> <input type="reset" value="Cancel"/> </form> <script language="javascript"> function check(form)/*function to check userid */ { if(form.userid.value == "JohnDoe") /* checkes userid */ { window.open("johndoe.php")/*target page */ } else { alert("Invalid Passcode, please try again!")/*error message*/ } } Hi all.I found this code on a forum to confirm that the user wants to delete the record from database and that the link has not pressed accidently.But it is not deleting the record even after pressing ok.This is may be because the id is not passed properly. Can anyone tell why?Do I need to modify the javascript function?Here is my code: Code: function confirmation() { var answer = confirm("Delete Record?") if (!answer){ window.location = "by_hand.php"; } else { window.location = "delete.php?delete=$id&action=deleteemployee"; } } PHP Code: <a href=# onclick='confirmation()'><img src='images/delete.png' alt='Delete' title='Delete' class='pngfix'></a> Hello there guys! Thanks for taking time to view this thread. It's appriciated! I found a really nice menu (Javascript, JQuery) im not so high tech on this myself, and not the best coder either but whenever I use this menu it gives the login box on the website an error, it doesn't let people login.. I've tried to localize the error myself, but I just dont know how to fix it, I think the issue is that the site system i use doesn't support these type of scripts which gives the login errors! I'm currently using a free website system, which allows you to customize anything you want called "uCoz" The menu i used was: http://www.dynamicdrive.com/dynamici...enu-glossy.htm And I think it's the jquery that gives the login box errors.. I'm thankfull for answers if anyone knows Hello everyone. I have a a html page that is used as a login page. I know it is not secure but this is just for learning purposes, I'm not using it for anything important. My problem is that when I put in the correct login all that happens is the page just clears the text boxes as if you were starting over. I am trying to get it to go to register.html which is located in the same directory as the login page. Help with what I'm doing wrong would be greatly appreciated. Here is the code: Code: <html> <head> <title>Login Page</title> </head> <body> <script type = "text/javascript"> var count = 2; function validate() { var un = document.myform.username.value; var pw = document.myform.pword.value; var valid = false; var unArray = ["Philip", "George", "Sarah", "Michael"]; // as many as you like - no comma after final entry var pwArray = ["Password1", "Password2", "Password3", "Password4"]; // the corresponding passwords; for (var i=0; i <unArray.length; i++) { if ((un == unArray[i]) && (pw == pwArray[i])) { valid = true; break; } } if (valid) { alert ("Login was successful"); window.location = "register.html"; return false; } var t = " tries"; if (count == 1) {t = " try"} if (count >= 1) { alert ("Invalid username and/or password. You have " + count + t + " left."); document.myform.username.value = ""; document.myform.pword.value = ""; setTimeout("document.myform.username.focus()", 25); setTimeout("document.myform.username.select()", 25); count --; } else { alert ("Still incorrect! You have no more tries left!"); document.myform.username.value = "No more tries allowed!"; document.myform.pword.value = ""; document.myform.username.disabled = true; document.myform.pword.disabled = true; return false; } } </script> <form> <table border ="5"> <tr> <th colspan="2">Login</th> </tr> <tr> <td>Username:</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="pword" /></td> </tr> <tr> <th colspan="2"><input type="Submit" value="Login" name="Submit" onClick="validate()" /><input type="Reset" value="Reset" /></th> </tr> </table> <p> <a href="register.html">New users click here to register</a> </p> </form></body></html> Hello everyone, I got this cool javascript for an all-in-one search engine at javascriptkit.com: http://www.javascriptkit.com/script/cut130.shtml I can already execute the script by clicking on the submit button, but I also want to execute the script by pressing the enter key within the text area. Can anyone please guide me through accomplishing this goal? Thanks, RK2 ============================== The code is as follows: Code: <script language="JavaScript"> <!-- // // Script by Jari Aarniala [www.mbnet.fi/~foo -- foo@mbnet.fi] // // This script makes it easy to choose with which search engine // you`d like to search the net. You may use this if you keep this // text here... // function startSearch(){ searchString = document.searchForm.searchText.value; if(searchString != ""){ searchEngine = document.searchForm.whichEngine.selectedIndex + 1; finalSearchString = ""; if(searchEngine == 1){ finalSearchString = "http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=.&q=" + searchString; } if(searchEngine == 2){ finalSearchString = "http://av.yahoo.com/bin/query?p=" + searchString + "&hc=0&hs=0"; } if(searchEngine == 3){ finalSearchString = "http://www.excite.com/search.gw?trace=a&search=" + searchString; } if(searchEngine == 4){ finalSearchString = "http://www.hotbot.com/?SW=web&SM=MC&MT=" + searchString + "&DC=10&DE=2&RG=NA&_v=2&act.search.x=89&act.search.y=7"; } if(searchEngine == 5){ finalSearchString = "http://www.infoseek.com/Titles?qt=" + searchString + "&col=WW&sv=IS&lk=noframes&nh=10"; } if(searchEngine == 6){ finalSearchString = "http://www.lycos.com/cgi-bin/pursuit?adv=%26adv%3B&cat=lycos&matchmode=and&query=" + searchString + "&x=45&y=11"; } if(searchEngine == 7){ finalSearchString = "http://netfind.aol.com/search.gw?search=" + searchString + "&c=web&lk=excite_netfind_us&src=1"; } location.href = finalSearchString; } } // --> </script> <basefont face="Verdana, Arial, sans-serif"> <form name="searchForm"> <table width=320 border cellpadding=3 cellspacing=2 bgcolor=444444> <tr> <td bgcolor=lightblue><font size=1 face="Verdana, Arial, sans-serif">Search for:<br> <td bgcolor=lightblue><font size=1 face="Verdana, Arial, sans-serif">Search from: <td bgcolor=lightblue> <tr> <td bgcolor=navajowhite><input style="background: dddddd" name="searchText" type="text"> <td bgcolor=navajowhite> <select style="background: dddddd" name="whichEngine"> <option selected>Altavista <option>Yahoo! <option>Excite <option>Hotbot <option>Infoseek <option>Lycos <option>AOL Netfind </select> <td bgcolor=navajowhite><input type="button" value="Send" onClick="startSearch()"> </select> </table> </form> <font size=1>Script by <a href="http://www.mbnet.fi/~foo/">Jari Aarniala</a>, <a href="mailto:foo@mbnet.fi">foo@mbnet.fi</a> I have this which runs on keyup in a textbox but i dont want it to run if the pressed key is enter, how would i go about that? Code: function getList() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { showDiv('#', 'result'); document.getElementById("result").innerHTML=xmlhttp.responseText; } } var user = document.getElementById('friendsSearch').value; xmlhttp.open("GET","../friendSearch.php?username="+user,true); xmlhttp.send(); } Good day! I created a login page and I have the username which is a textbox type, department and i use option and a submit button.. I want that when i open my webpage automaticallt the cursor was on the textbox and when i am done in typing my username and i press the enter key the focus would be on the option which where i can choose my department and when i am done choosing my department and i press the enter key i automatic login and go to the department page. Here is the code: PHP Code: <?php session_start(); //require_once 'conn.php'; $db_name="dspi"; mysql_connect("localhost", "root", "") or die("Cannot connect to server"); mysql_select_db("$db_name")or die("Cannot select DB"); $department = mysql_real_escape_string($_POST['department']); $username = mysql_real_escape_string($_POST['username']); $sql=mysql_query("SELECT `Department`, `Username` FROM `tbllogin` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mysql_error()); $ct = mysql_num_rows($sql); if($ct == 1) { $row = mysql_fetch_assoc($sql); if($row['Department']=='Accounting') { header('location: Company.php'); } elseif($row['Department']=='Engineering') { header('location: Company.php'); } elseif($row['Department']=='Finishing_Goods') { header('location: Company.php'); } elseif($row['Department']=='HRAD') { header('location: Company.php'); } elseif($row['Department']=='MIS') { header('location:Company.php'); } elseif($row['Department']=='Packaging_and_Design') { header('location:Company.php'); } elseif($row['Department']=='Production') { header('location:Company.php'); } elseif($row['Department']=='Purchasing_Logistic') { header('location:Company.php'); } elseif($row['Department']=='QA_and_Technical') { header('location:Company.php'); } elseif($row['Department']=='Supply_Chain') { header('location:Company.php'); } else { header('location:dspi_login.php'); echo"Incorrect Username or Department"; } } ?> <!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>Login</title> <script> function searchKeyPress(e) { // look for window.event in case event isn't passed in if (window.event) { e = window.event; } if (e.keyCode == 13) { document.getElementById('submit').focus(); } } </script> <style type="text/css"> <!-- BODY { background-image: url(layout_image/bgroundv09.png); background-attachment: fixed; } #Dept_Frame { position:absolute; width:229px; height:49px; z-index:1; left: 441px; top: 262px; } #Department_Option { position:absolute; width:186px; height:32px; z-index:2; left: 455px; top: 275px; } #Submit_Frame { position:absolute; width:82px; height:35px; z-index:3; left: 516px; top: 320px; } #Submit_Button { position:absolute; width:60px; height:29px; z-index:4; left: 525px; top: 328px; } #Username_ImageText { position:absolute; width:130px; height:55px; z-index:5; left: 319px; top: 208px; } #User_Frame { position:absolute; width:230px; height:46px; z-index:6; left: 441px; top: 216px; } #Username_Textbox { position:absolute; width:182px; height:23px; z-index:7; left: 457px; top: 228px; } --> </style> </head> <body> <form id="form1" name="form1" method="post" action=""> <div id="Department_Option"> <select name="department" onkeypress="searchKeyPress(event);"> <option>Choose your Department. . . . . . </option> <option value="Accounting" <?php if($_POST['department'] == 'Accounting') echo "selected='selected'"; ?>>Accounting</option> <option value="Engineering" <?php if($_POST['department'] == 'Engineering') echo "selected='selected'"; ?>>Engineering</option> <option value="Finishing_Goods" <?php if($_POST['department'] == 'Finishing_Goods') echo "selected='selected'"; ?>>Finishing Goods</option> <option value="HRAD" <?php if($_POST['department'] == 'HRAD') echo "selected='selected'"; ?>>HRAD</option> <option value="MIS" <?php if($_POST['department'] == 'MIS') echo "selected='selected'"; ?>>MIS</option> <option value="Packaging_and_Design" <?php if($_POST['department'] == 'Packaging_and_Design') echo "selected='selected'"; ?>>Packaging and Design</option> <option value="Production" <?php if($_POST['department'] == 'Production') echo "selected='selected'"; ?>>Production</option> <option value="Purchasing_Logistic" <?php if($_POST['department'] == 'Purchasing_Logistic') echo "selected='selected'"; ?>>Purchasing and Logistics</option> <option value="QA_and_Technical" <?php if($_POST['department'] == 'QA_and_Technical') echo "selected='selected'"; ?>>QA and Technical</option> <option value="Supply_Chain" <?php if($_POST['department'] == 'Supply_Chain') echo "selected='selected'"; ?>>Supply Chain</option> </select> </div> <div id="Submit_Button"> <input type="Submit" name="submit" value="Submit" id="submit" onclick="doSomething();"/> </div> <div id="Dept_Frame"><img src="layout_image/subframev02.png" width="229" height="50" /></div> <div id="Submit_Frame"><img src="layout_image/subframev02.png" width="80" height="46" /></div> <div id="Username_ImageText"><img src="layout_image/userv01.png" width="131" height="62" /></div> <div id="User_Frame"><img src="layout_image/subframev02.png" width="229" height="50" /></div> <div id="Username_Textbox"> <input name="username" type="text" size="30" /> </div> </form> </body> </html> I hope that somebody help me to solve my problem Hi, Just wondering if you guys can help me to make the following script to work when the enter/return key is pressed, intead of having to click on the button? Code: <Script language=JavaScript> function read_model (form) { ModelVar =form.model_input.value; window.location= ("http://www.sony.co.uk/product/dsc-t-series/" + ModelVar + "/tab/technicalSpecs"); } </script> <form name=model_form action="" method=GET> Enter Sony Model Number (e.g. dsc-tx5): <input type=text name=model_input value="" size=9> <input type=button name=model_button value=Click onClick="read_model(this.form)"> </form> <script language=JavaScript> document.model_form.model_input.focus(); </script> I've searched the net for ways of achieving this, but for some reason none of the code i've tried works..! Also, if this make a difference, the page will mainly be used in Firefox. I'd be really greatfull if someone can help me with this, Thanks! Hey, I currently have an input box which submits my input box value to php script with a bit of JS: Code: <input type="text" class="cssShoutForm" name="sbText" onSubmit="this.disabled=true; shoutIt()"> <input type="button" name="Shout" value="Submit" class="cssShoutButton" onClick="this.disabled=true; shoutIt()"> Now when a use clicks the submit button and submits the text - input box clears which is perfect but if a user hits enter the value stays in the input box which is a pain cos you have to delete it to type in the next line. Why is this? This is my JS: Code: function shoutIt() { document.fShout.admin.value = ""; document.fShout.submit(); setTimeout("document.fShout.sbText.value=''", 1000); setTimeout("document.fShout.Shout.disabled=false", 1000); } How can i get it to also clear on a user hitting enter? |