SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    The Jellophonic Autobrain CHeeSeBLiND's Avatar
    Join Date
    Jul 2001
    Location
    Bolton, England
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onlick empty field

    when a user clicks on a text field, how can i make the value empty instead of its original value?

    ta
    hmm...

  2. #2
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you might be able to do it inline, but i do everything with functions, so here is one way.

    <script language="javascript">
    function clearIt(ref) {
    ref.value = "";
    }
    </script>

    ...


    <input type="text" id="txtSomething" onClick="clearIt(this)" />

  3. #3
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <input type="text" name="bob" value="this would be valuable" onfocus="this.value=''">


    Short and sweet. And I do agree with makedata. But with something this small a function seems a waste of code.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


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
  •