SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    calif
    Posts
    743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help adding field box text to Search Form

    I have this Form code that works successfully to Search a web site (below).
    How can I add text in the field/box that will disappear when the field/box is selected to add search keywords to?
    Also, how can I widen the field/box?
    Any help/examples/suggestions will be appreciated.

    Code:
    <form method="get" action="search.php">
    <div id="siteSearch">
    Enter Search Words <img src="themes/default/images/arrow-red.png">&nbsp;&nbsp;
    <input type="hidden" name="type" value="videos"/>
    <input type="text" name="keyword" id="sbi1" value="" onfocus="if(this.value==this.defaultValue) this.value='';">
    <input type="image" align="middle" src="images/search.png"  name="sa" value="Search" id="mySearch"/><br/>
    </div>
    </form>

  2. #2
    SitePoint Addict bronze trophy
    Join Date
    Sep 2005
    Posts
    317
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    You can widen the size of a text box with css and changing the width attribute. You can also add in size="30" attribute if you don't want to use css.

    Code:
    if(this.value==this.defaultValue) this.value='';
    Not sure what the above is for; is that you trying to remove any placeholder text when the user clicks on the input?


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
  •