Solved

onkeyup and onkeydown for subtexts in a text

Posted on 2004-10-08
2
1,117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

738 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