Solved

onkeyup and onkeydown for subtexts in a text

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now