Reply
Having trouble with my site search input boxes
Old 06-19-2008, 02:57 PM Having trouble with my site search input boxes
Junior Talker

Posts: 1
Name: David
I want to be able to put a (value="SEARCH") in the input box but make it disapear when clicked. The problem is that the search code has a JS browser compatability code, so when I try to insert (onfocus="this.value=' '") the input box does not display on my website. any ideas?

my code:

Code:
<SCRIPT language=Javascript>
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
// *** BROWSER VERSION ***
// note: on IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) ||
(agt.indexOf("; nav") != -1)) );
var is_nav5 = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));
var is_ie = (agt.indexOf("msie") != -1);
var is_ie3 = (is_ie && (is_major < 4));
var is_ie4 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5 = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5up = (is_ie && !is_ie3 && !is_ie4);
</SCRIPT>
<SCRIPT language=Javascript>
if (is_nav4) {
document.write('<input type=text name=Search value="SEARCH" id="search_v5_1" size=7 maxlength=50>');
} else if (is_nav5up) {
document.write('<input type=text name=Search value="SEARCH" id="search_v5_2" size=12 maxlength=50>');
} else {
document.write('<input type=text name=Search value="SEARCH" id="search_v5_3" size=15 maxlength=50>');
}
</SCRIPT>
opoohwan is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-19-2008, 03:57 PM Re: Having trouble with my site search input boxes
nyef's Avatar
Ultra Talker

Posts: 267
Name: Lucas
What do you mean by "the search code has a JS browser compatability code"?

What you described, onfocus="this.value=' ';", should work fine...
__________________
~nyef
Over 5000 free games!
nyef is offline
Reply With Quote
View Public Profile Visit nyef's homepage!
 
Reply     « Reply to Having trouble with my site search input boxes
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11246 seconds with 12 queries