473,378 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

JavaScript - onKeyPress, onKeyUp

Hello
I have an input box and a button that runs a function taking the input as a parameter. The button click works fine. The problem is it needs to respond to the enter key. I have it responding to the enter key, but in both ff and ie it loads the function produces the correct output, but then it looks like the page refreshes and the output is gone.

Suggestions?

Expand|Select|Wrap|Line Numbers
  1. function test(e)
  2. {
  3.  
  4.     var e = e.keyCode
  5.     if (e == 13)
  6.     {
  7.         findit();
  8.         alert("Hi!")
  9.  
  10.     } 
  11. }
  12.  
Jun 14 '08 #1
1 2001
mrhoo
428 256MB
default browser behavior is to submit a form if there is a single input text element and enter is pressed.

set the form's onsubmit method to return false,
and call its submit() directly when you want to upload the form.
Jun 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: kaeli | last post by:
All, I've been unable to find out if javascript supports for (var e in obj) type of looping syntax. Does it? If so, is this for DOM browsers only? TIA! --
19
by: tnhoe | last post by:
Hi, any excel like grid javascript which is stable and fast to load thousand of rows data ? can it have F2 function to popup another window ? can validate cell value when cursor move away that...
6
by: Justin Beasley | last post by:
Here is an answer for those who are looking for a keystroke evaluation script that works in Internet Explorer (IE 5.5, 6.0, 7.0 for PC--IE 4.0, 5.2 for Mac), Mozilla Firefox (Windows, Linux, and...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
4
by: Greg | last post by:
I'm guessing the problem I'm having has something to do with Master Pages or DetailsView because the exact same code works fine on a page without a Master Page and DetailsView controls. The...
1
by: monotreme | last post by:
I have a form one input. If you set it up with onchange="somejavascript...." and you type into the input field it does the javascript. If you scan a barcode into the input box it doesn't trigger...
4
by: Grant Merwitz | last post by:
Hi I am trying to implement the Microsoft Ajax.NET extensions to perform a lookup on a key press of a text box. What this will do is once a user enters a letter into the textbox, this will...
1
by: critchey1 | last post by:
Hey everyone, i've been playing around with trying to get some scripts to work with detecting whether flash player is installed on your computer or not. I found a flash detection kit on the adobe...
8
by: Tony Johansson | last post by:
Hello! I wonder can somebody explain when is it suitable to use these methods OnKeyUp, OnKeyDown and OnKeyPress because these raise an event. These are located in class UserControl. If these...
4
by: sureshl | last post by:
function cal() { var f = document.form1; var regExp_Count = new RegExp("^+$"); f.price1.value = parseFloat(f.baseprice.value*(f.percen.value/100)).toFixed(0); } cal() functions , will...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.