ilikephp Posted September 3, 2009 Share Posted September 3, 2009 Hello, I need to create a search button that displays "click to search" and when the user clicks, it wil disappear. How can I do it please? Thanks in advance... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 3, 2009 Share Posted September 3, 2009 <input type="button" value="click to search" onclick="this.style.display = 'none';" /> Quote Link to comment Share on other sites More sharing options...
ilikephp Posted September 3, 2009 Author Share Posted September 3, 2009 Thx a lot (Y) Quote Link to comment Share on other sites More sharing options...
ilikephp Posted September 4, 2009 Author Share Posted September 4, 2009 Thanks again for the script! But I got confused: I need the text inside the field to disappear: The code below is disappearing all the field: <input type="field" value="click to search..." onclick="this.style.display = 'none';" /> Quote Link to comment Share on other sites More sharing options...
ilikephp Posted September 4, 2009 Author Share Posted September 4, 2009 I fixed it: <input type="field" value="click to search..." onfocus="this.value='';return false" /> but if I dont enter any value inside the field and I click anywhere else I need the "click to search to appear again" how can I do it please? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted September 4, 2009 Share Posted September 4, 2009 ok...i see what you want now...and it's a little more complicated: <input type="text" value="click to search..." title="click to search..." onfocus="if(this.title==this.value)this.value='';" onblur="if(this.value=='')this.value=this.title;" /> Quote Link to comment Share on other sites More sharing options...
ilikephp Posted September 4, 2009 Author Share Posted September 4, 2009 Thx (Y) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.