Results 1 to 4 of 4

Thread: need to create search textbox

  1. #1
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default need to create search textbox

    http://www.htmlforums.com/html-xhtml...tml#post857992

    Hello,

    I'm trying to create a search textbox. It should contain a spyglass icon inside the textbox aligned to the right. It needs to conform to the following criteria:

    * the spyglass needs to be clickable with a customizable javascript handler to handle the click event.
    * When the user enters text into the textbox, it should not overlap with the spyglass.
    * There should be no X to the right of the textbox. Some textboxes have an X to the right which clears the text if clicked. I don't want this.
    * It should work in at least IE and Chrome.

    Can someone help me with this? Thank you.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    How about approaching it like this;

    - start with a text input field, styled to make it invisible (no border, etc)
    - put your submit button alongside with an image or CSS icon http://www.lets-develop.com/html5-ht...submit-button/ you should be able to attach whatever handler you like to it
    - wrap them in a div and style that to look like a text box
    - as for removing the "x", this should help http://geektnt.com/how-to-remove-x-f...me-and-ie.html
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Something like this?
    Code:
    <form  style="position: relative; display: inline; " action="http://your_search_engin.html" method="get" accept-charset="utf-8" onsubmit="your_submit_function()">
    <input type="text" size="10" style="font-family: arial; font-size: 13px; position: relative; top: 0px; background: white; border: 1px solid silver; margin-left: 25px; width: 200px; height: 30px; padding-right: 25px" onclick="reset()"> 
    <input type="image" style="position: relative; width:35px; top: 11px; margin-left: -35px; background: transparent; opacity: 0.5" src="http://cdn5.iconfinder.com/data/icons/glyph_set/128/search.png" name="submit" alt="click to search">
    </form>

  4. #4
    Join Date
    Jun 2008
    Posts
    192
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default

    Thank both,

    I followed these techniques and it works.

Similar Threads

  1. create text to textbox using java script
    By prashant_ora in forum Looking for such a script or service
    Replies: 4
    Last Post: 09-15-2011, 02:41 PM
  2. Create a word document from a search
    By Humper in forum PHP
    Replies: 10
    Last Post: 12-19-2008, 08:33 PM
  3. create search engine in my site
    By lord22 in forum PHP
    Replies: 10
    Last Post: 07-29-2008, 08:01 PM
  4. Search Textbox like Answers.com
    By miumiu in forum JavaScript
    Replies: 3
    Last Post: 02-24-2006, 04:58 PM
  5. Search a textbox for a certain character
    By johnnyi in forum JavaScript
    Replies: 7
    Last Post: 08-23-2005, 07:23 PM

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
  •