Solved

onkeyup and onkeydown for subtexts in a text

Posted on 2004-10-08
2
1,116 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

740 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