PDA

View Full Version : Javascript help :)



Florx
04-11-2007, 03:14 PM
Hey!

Thanks for reading this. :)

Its appreciated.

Anyway I need a way of javascript changing the contents of a field while i am typing in it.

e.g. I type 123456 and it changes it to 12:34:56.

It needs to change on type also. So if I type 123 it changes to 12:3.

Ive googled around but didn't find anything. If there is a way of doing this without a javascript library it would be great :)

Thanks +rep to all who help.

Beau
04-11-2007, 08:48 PM
I don't know about what sort of function you're going to develop to do this, but if you want to know how to make a form field execute a javascript command while it's being typed in:



<input type="text" name="test" onkeyup="javascriptCommand();">

Florx
04-11-2007, 09:02 PM
That's wrong.

<input type="text" name="test" onkeyup="javascript:Command();">It needs a colon :p

iTechnical
04-11-2007, 09:05 PM
Uhh. Can't think :(

Beau
05-11-2007, 05:03 AM
That's wrong.

<input type="text" name="test" onkeyup="javascript:Command();">It needs a colon :p

No, no. You don't need the javascript: prefix. I was literally calling the function javacriptCommand().

Just to clarify, if you were calling the function checkTextBox(), you would do the following:



<input type="text" name="test" onkeyup="checkTextBox();">

Florx
06-11-2007, 03:46 PM
Thread closed. I managed it.

Want to hide these adverts? Register an account for free!