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... Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/ 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';" /> Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-911863 Share on other sites More sharing options...
ilikephp Posted September 3, 2009 Author Share Posted September 3, 2009 Thx a lot (Y) Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-912063 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';" /> Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-912360 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? Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-912368 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;" /> Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-912376 Share on other sites More sharing options...
ilikephp Posted September 4, 2009 Author Share Posted September 4, 2009 Thx (Y) Link to comment https://forums.phpfreaks.com/topic/173012-solved-search-button/#findComment-912557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.