469,304 Members | 2,192 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

Adding Spaces in a FormBox

Is there a script that would add a space in front of and behind any
text adding to a form box, it coud be triggered by either an onClick or
onBlur event handler. Any help s appreciated. Thanks Joe

Sep 16 '05 #1
2 1505
Papajo schrieb:
Is there a script that would add a space in front of and behind any
text adding to a form box, it coud be triggered by either an onClick or
onBlur event handler. Any help s appreciated. Thanks Joe


What do you want to get? If it's just about optic, you can use CSS (padding). If
you're in need of real blanks, you can do something like

document.getElementById("ID of the inputelement").value = " " +
document.getElementById("ID of the inputelement").value + " "
Sep 16 '05 #2

Papajo wrote:
Is there a script that would add a space in front of and behind any
text adding to a form box, it coud be triggered by either an onClick or
onBlur event handler. Any help s appreciated. Thanks Joe


Why are you adding spaces to your form box entries? Most people want
to trim out any extra spaces. To add a space you should be able to
just say

onclick="nameoftextbox.value = nameoftextbox.value + ' ';"

Are you trying to parse something out of the form box?

http://www.askblax.com

Sep 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.