SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Quezon City, Philippines
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text inside texfield

    I want to have a textfield with an initial value of "name:" and when the visitor clicks his mouse inside the textfield the initial value will dissappear. Just like the search function in this forum.

  2. #2
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onFocus="this.value = '';"
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Quezon City, Philippines
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thanks for the help.
    Last edited by ibm586; Jan 27, 2003 at 07:37.

  4. #4
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dale_burrell
    onFocus="this.value = '';"
    Don't you mean:

    Code:
    <input type="text" name="txtTest" value="name:" onFocus="this.value=''" />
    However, even this solution has problems in that anytime they focus on the textbox, their input will disappear. A better solution might be to call a function which sets a flag telling us to only clear the textbox once.

  5. #5
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by makeda


    Don't you mean:

    Code:
    <input type="text" name="txtTest" value="name:" onFocus="this.value=''" />
    However, even this solution has problems in that anytime they focus on the textbox, their input will disappear. A better solution might be to call a function which sets a flag telling us to only clear the textbox once.
    I assumed that the rest of the tag could be deduced. For a complete solution you might store a flag - but if they want it Just like the search function in this forum. then it has exactly the limitation you mention
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  6. #6
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    EDIT--

    Sorry, I misread your post...i thought you had the semi-colon inside of the quotation marks but i now realize you had it at the end of 2 single quotes. I think i need some glasses.


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
  •