> Guess the follow-up question is how to clear spaces behind
> cursor when entering data into a field -- a script to
> remove trailing spaces as the user types.

I don't believe there's a DOM standard way to do this (at least that I
know of)... IE has an onKeyUp attribute, which would be a nice
addition to DOM to provide this sort of functionality...

<input >
<script language="_javascript_">
  function removeSpace(in) {
    // remove spaces in the input value
    in.value = in.value.replace(/\s/,"");
  }
</script>

If you need a solution that's DOM standard, you'd probably have to use
this function in an onsubmit() event on the form prior to validating
the value in the field. You could use an onblur() event in addition,
although with an text input it's not necessary to blur the field in
order to submit the form with many browsers, like IE which will submit
the form if you hit enter while the cursor is in a text field.

s. isaac dealey     954.927.5117
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to