A good way to show default text in searchbox

Moderator: youngmoney

<<

mickni

Posts: 150

Joined: Thu Dec 31, 2009 10:50 am

Location: NY

Post Mon Mar 14, 2011 9:00 am

A good way to show default text in searchbox

Have you seen this site's searchbox?It shows Search... by default,when it get focus,it's blank.Actually this can be done by simple html code.I just know it last week,share it to you all.
  Code:
<input name="s" value="Search..." onfocus="if(value=='Search...'){value=''}" onblur="if(value==''){value='Search...'}">

Actually it works for me in this way
  Code:
<input name="s" value="Search..." onfocus="if(value==\'Search...\'){value=\'\'}" onblur="if(value==\'\'){value=\'Search...\'}">

I have used the \ to transfer meanings.
All the secrets you need to know about how to make money online
<<

Teoykk

Posts: 10

Joined: Sat Jan 02, 2010 6:19 pm

Post Wed Mar 16, 2011 1:37 am

Re: A good way to show default text in searchbox

well,yes,you need to do that if you are using it in a string
<<

Fagun

Posts: 19

Joined: Sun Apr 03, 2011 7:33 pm

Post Sun Apr 03, 2011 7:59 pm

Re: A good way to show default text in searchbox

oH!!!! Its great. I am so much happy to get this information #:-s
<<

buzzbuck

Posts: 293

Joined: Sun Jul 03, 2011 2:18 am

Post Thu Aug 04, 2011 4:47 am

Re: A good way to show default text in searchbox

Good post mate. Website design is just about tweaking code. There is no optimal solution. You have to learn it by experiment. And I like your approach as you are doing just that.
Quick Money Making Ideas
Money making guides, Payment Proofs & How To's
<<

Roycedric

Posts: 31

Joined: Thu Aug 04, 2011 9:04 am

Post Fri Aug 05, 2011 7:21 am

Re: A good way to show default text in searchbox

it is useful. We can also use one technique called textbox watermarking using javascript. Also modify the css to show the default text . The coding is
<input type="text" class="hint" value="Search..."
onfocus="if (this.className=='hint') { this.className = ''; this.value = ''; }"
onblur="if (this.value == '') { this.className = 'hint'; this.value = 'Search...'; }">


  • Advertisement

Return to HTML&CSS

Who is online

Users browsing this forum: No registered users and 0 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.


phpBB SEO
Time : 0.148s | 12 Queries | GZIP : Off