473,386 Members | 1,693 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,386 software developers and data experts.

onkeypress event problem

I have several <input type = 'text' ....> where I would like to allow
certain hotkeys to auto fill the data.

ie shift + 1, shitf + 2 etc etc

so I have

<input type = 'text' name = 'test_input' onkeypress =
'Check_Keys(this);'>

function Check_Keys(id)
{
if (window.event.shiftKey)
switch (window.event.keyCode) {
case 33: // Shift + 1
id.value = "You hit Shift + 1";
return false;
break;
}
return true;
}

Now if I hit shift +1 it fills the input with You hit Shift +1 but it
also appends a "!"

How can I tell it not to append the last keystroke?

Apr 11 '06 #1
2 1157
I was able to get it to not append the keystroke however now I want to
force an onChange event to occur. How can I go about doing this?

Apr 11 '06 #2
MB
"Wescotte" <we******@earthlink.net> skrev i meddelandet
news:11**********************@g10g2000cwb.googlegr oups.com...
I was able to get it to not append the keystroke however now I want to
force an onChange event to occur. How can I go about doing this?


In the Check_Keys function:

id.fireEvent("onchange");
Apr 12 '06 #3

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

Similar topics

5
by: Fred Brown | last post by:
Hi, I want to cancel a certain key in JavaScript. To do so, I catch the event in OnKeyPress and cancel the default: <head> .... function f(evt) { var evt = (evt) ? evt : ((window.event) ?...
5
by: Albert Wagner | last post by:
I have included a file below that tests onKeyPress in Opera 7.11. I am getting peculiar behavior. When the file is first loaded, pressing the keypad + causes the textarea to get physically larger...
7
by: Kev | last post by:
I need to make some specific alterations to some JavaScript in webpages in order to comply with government guidelines on accessibility. Apparently, whenever the OnClick event is used, it must be...
2
by: Hasan Ammar | last post by:
Is it possible to set up hotkeys using onkeypress? I know it can be done with the usual alphanumeric keys, but what about function keys? or using ctrl/alt combinations? Does anybody have a...
3
by: addi | last post by:
I'm looking to perform input validation on an HTML input text element; specifically, I'm looking to prevent anything other than numerical characters from being entered. I've got it working just...
1
by: Simon Wigzell | last post by:
I'm using a javascript function to interecept all key presses and check for valid character and also check the length of the current string and if it is greater than a sent value, set the focus to...
3
by: Robert Inder | last post by:
I am struggling to catch kestrokes within an Internet Explorer 6 window. My window happens to be displaying three frames, though I suspect a similar problem would arise with a single document. ...
1
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works...
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...
3
by: gjain12 | last post by:
Hi all, I am using the following code to disable the ctrl+a/c/v/x keys. <html> <head> <script language="JavaScript" type="text/javascript"> function disableCtrlKeyCombination(e) { //list...
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: 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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.