SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is there something like onKillFocus?

    in actionscript there is an onSetFocus which is equivalent to javascript onfocus but in actionscript there is also an onKillFocus (when the focus of something leaves).

    I have a text box that says [enter some text]

    i use javascript and onfocus to remove that text when the text field it selected.

    however when the user clicks away (or kills focus) I want to check to see if they actually typed anything and if not to put the [enter some text] back in place.

    i tried onchange but i guess that only works if the user changes it not if javascript changes it.

    so is there something like what I am looking for?

    Thanks.
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by halfasleeps View Post
    when the user clicks away (or kills focus) I want to check to see if they actually typed anything and if not to put the [enter some text] back in place.
    I think this should do it.
    Code:
    <input type='text' onblur="if(this.value=='')this.value=this.defaultValue" onfocus="this.value=''">
    Tab-indentation is a crime against humanity.

  3. #3
    Pragmatic Programmer halfasleeps's Avatar
    Join Date
    Feb 2006
    Location
    Altoona, PA. USA
    Posts
    1,945
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey thanks, onblur was what i needed!
    Altoona Design
    Freelance Flex developer for hire.
    ActionScript Programmer with 8 Years Experience.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •