473,569 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need my <input type=text> to fire a JavaScript on "enter"

Hi guys,

The framework of my page is an aspx page with a header and a footer.
The header is a menu system and depending on what you select there
different ascx pages are loaded into the middle part. So the entire
page is encased in <form> tags. For this reason I cannot create <form>
tags on a given ascx page. It screws things up. So, on one of my
controls, I have the following

-- set of 6 <input type=text id="myId">
-- <input type=button value="Search" onclick="Search Documents()">

Wehn you click the button it fires the script and does its thing. I
also want that if you hit enter
while you are in one of the text fields, it will fire the same script.
Remember you cant encase
the 7 elements into a <form>

Thanks-

Feb 23 '06 #1
2 2356
VK

Hoss wrote:
Hi guys,

The framework of my page is an aspx page with a header and a footer.
The header is a menu system and depending on what you select there
different ascx pages are loaded into the middle part. So the entire
page is encased in <form> tags. For this reason I cannot create <form>
tags on a given ascx page. It screws things up. So, on one of my
controls, I have the following

-- set of 6 <input type=text id="myId">
-- <input type=button value="Search" onclick="Search Documents()">

Wehn you click the button it fires the script and does its thing. I
also want that if you hit enter
while you are in one of the text fields, it will fire the same script.
Remember you cant encase
the 7 elements into a <form>


<input type="text" name="myName" onkeydown="
var key = event.which || event.keyCode;
if (key == 13) {// ? I guess for Enter - you better check
SearchDocuments ();
return false;
}
">

Feb 23 '06 #2
Wonderful. Works great. Thanks a bunch.

Feb 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14863
by: lgo | last post by:
I have read several variations of this topic posted on this news group. However I was not able to find the answer for my problem. I am trying to build code (see below) to update a large single record using data from a temporary (editing) table with identical field structure. I iterate through the fields (some 50 of them) with a For Each -...
5
2172
by: Kivak Wolf | last post by:
Hey everyone, I have a textbox in my web page that is going to be used to enter an E-mail into (just plain text, no HTML). Now, this will interact with a SQL database where the contents of the textbox are sent from the SQL database to the textbox, then the user edits it, and then the text inside the textbox is sent back to the SQL database....
8
161628
by: John Brock | last post by:
I am creating an Excel workbook using VB.NET, and have run into a problem. Excel at times insists on reformatting data that I enter into cells, e.g., converting "01234" to "1234", and this screws me up when I need to read the data back. When I run into this problem using Excel interactively I simply change the cell Number format from...
2
2249
by: alxasa | last post by:
Hello, I am hoping someone can help me with this. I need a javascript function, which sits inside a <input type="text" name="firstname"> line of code. Now, if someone starts typing fine, but when it goes 1 character past 15 characters (15 characters only allowed), in this case I would like the contents of the input to be cleared out...
2
11746
by: mattgarvin | last post by:
Hello, I need a piece of javascript that will allow a form to be submitted when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of Safari. It is for a login page that has two textboxes: a "Login" and a "Password". The "Login Button" is actually a standard image with an onClick event handler to submit the form, because we use...
3
7682
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter...
7
20856
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus...
8
2051
by: Freddy Coal | last post by:
Hi, I would like make a search and replace in a file, for that I need get the text in a textbox, but I need recognyze literally characters of the user like a commands, for example: The chain of the user is: "Hello world" & chr(64) & vbcrlf If I capture the textbox, I get: ""Hello world" & chr(64) & vbcrlf" But I would like get the...
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.