Solved

onkeyup and onkeydown for subtexts in a text

Posted on 2004-10-08
2
1,114 Views
Last Modified: 2008-03-06
Ok, the scenario is:

I have a text box.. I want to fire "onkeyup" and "onkeydown" events in that textbox after i enter a space in it !

In detail:

I have to insert WORK_HOURS, PLACE_OF_WORK and DETAILS_OF_WORK in one textbox.(thats called Quick Insert mode of our project). Those 3 should be seperated by space. For example, consider i enter:

8.00 Germany Time manegement project

where,

8.00 --> WORK_HOURS
Germany --> PLACE_OF_WORK
Time manegement project --> DETAILS_OF_WORK.

(Note: I split the strnig in server side with no problem.)

what i want is: after i enter the first space (after "8.00") i need to fire onkeyup and onkeydown events till the next space(before "Time manegement project"). that is, i need to call onkeyup and onkeydown events for "Germany" in my example.

Hope that makes sense.
0
Comment
Question by:ldbkutty
2 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 400 total points
ID: 12258111
Like this:

<input type=text onKeyUp="w=this.value.split(' ');if(w.length==2&&w[1]=='')this.value+='Germany '">

0
 
LVL 9

Assisted Solution

by:riyasjef
riyasjef earned 100 total points
ID: 12258599
here my script

<input type=text

onKeyUp="this.value=this.value.replace(/(8\.00\s+)$/gi,'$1Germany').replace(/(8\.00\s+Germany\s+)$/gi,'$1Time manegement

project')">

riyasjef
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question