| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Getting this to work in Firefox?Code: <script language="javascript">
function checkform(form){
if(form["q"].value == ""){
alert("Please insert keyword(s) to search for");
form["q"].focus();
return false ;
}
return true;
}
function toProperCase(astring){
return astring.toLowerCase().replace(/\w+/g,function(s){return s.charAt(0).toUpperCase() + s.substr(1);})
}
function changemode(newmode){
document.all.m.value=newmode.toLowerCase();
document.all.sixBtn.value=toProperCase(newmode)+' Search';
document.all.web.className="standardmode";
document.all.Local.className="standardmode";
document.all.Images.className="standardmode";
document.all.News.className="standardmode";
document.all.Video.className="standardmode";
document.all.Domains.className="standardmode";
document.getElementById(newmode).className="newmode";
if(newmode == "Local"){
document.all.q.style.width="192px";
document.getElementById("localSearchBar").innerHTML=" <input name=\"location\" id=\"location\" size=\"27\" value=\"Location (eg: NY or Zip Code)\" onFocus=\"if(this.value=='Location (eg: NY or Zip Code)'){this.select();}\" />";
}
else{
document.all.q.style.width="384px";
document.getElementById("localSearchBar").innerHTML="";
}
}
</script> ????: NamePros.com http://www.namepros.com/programming/194308-getting-this-to-work-in-firefox.html a) what do I need to do to this code to make it compatible with firefox? b) how would I integrate it so that it chooses the right code for the right browser c) are there any other browsers that I need to code it for? Thanks a lot Tom |
| |
| | #4 (permalink) |
| NamePros Member Join Date: Jan 2005
Posts: 97
![]() | I agree with Noobie. Is there something that isn't preforming the way it should? Or are you just assumming it won't work as is?
__________________ AEInbetween |
| |
| | THREAD STARTER #5 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | if you have firefox, go into it: http://www.beta.6yd.net/beta_search/ the links don't work. here is the code where the links are: Code: <div onClick="changemode('web')" class="newmode" id="web">Web</div>
|
<div onClick="changemode('Local')" class="standardmode" id="Local">Local</div>
|
<div onClick="changemode('Images')" class="standardmode" id="Images">Images</div>
|
<div onClick="changemode('News')" class="standardmode" id="News">News</div>
|
<div onClick="changemode('Video')" class="standardmode" id="Video">Video</div>
|
<div onClick="changemode('Domains')" class="standardmode" id="Domains">Domains</div>
|
<div onClick="location.href='more'" class="standardmode" id="more">More »</div> |
| |
| | #6 (permalink) |
| NamePros Member Join Date: Jan 2005
Posts: 97
![]() | I did a little research and well the problem is your use of document.all in your changeMode function which isn't supported by mozilla (I think few browser do). You need to use the document.getElementById() which is the W3C standard for grabbing elements and so is supported even in IE. Code: <script language="javascript">
function checkform(form){
if(form["q"].value == ""){
alert("Please insert keyword(s) to search for");
form["q"].focus();
return false ;
}
return true;
}
function toProperCase(astring){
return astring.toLowerCase().replace(/\w+/g,function(s){return s.charAt(0).toUpperCase() + s.substr(1);})
}
function changemode(newmode){
document.getElementById("m").value=newmode.toLowerCase();
document.getElementById("sixBtn").value=toProperCase(newmode)+' Search';
document.getElementById("web").className="standardmode";
document.getElementById("Local").className="standardmode";
document.getElementById("Images").className="standardmode";
document.getElementById("News").className="standardmode";
document.getElementById("Video").className="standardmode";
document.getElementById("Domains").className="standardmode";
document.getElementById(newmode).className="newmode";
if(newmode == "Local"){
document.getElementById("q").style.width="192px";
document.getElementById("localSearchBar").innerHTML=" <input name=\"location\" id=\"location\" size=\"27\" value=\"Location (eg: NY or Zip Code)\" onFocus=\"if(this.value=='Location (eg: NY or Zip Code)'){this.select();}\" />";
}
else{
document.getElementById("q").style.width="384px";
document.getElementById("localSearchBar").innerHTML="";
}
}
</script>
__________________ AEInbetween |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |