NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Getting this to work in Firefox?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-05-2006, 04:10 PM THREAD STARTER               #1 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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="&nbsp;<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>
I know that firefox uses different versions of Javascript, but:
????: 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
PoorDoggie is offline  
Old 05-07-2006, 02:13 AM THREAD STARTER               #2 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



no-one know?
PoorDoggie is offline  
Old 05-07-2006, 05:41 AM   #3 (permalink)
NamePros Regular
 
Noobie's Avatar
Join Date: Feb 2006
Location: Montreal, Quebec, Canada
Posts: 324
Noobie is on a distinguished road
 



I've looked it over a few times and i'm not really sure what you want to do but I think all the functions you have are compatible with Firefox as far as I know.
__________________
Goldkey.com is a scam
What's your BMI? | Timestamp Generator
Noobie is offline  
Old 05-07-2006, 10:54 AM   #4 (permalink)
NamePros Member
 
crazyluv's Avatar
Join Date: Jan 2005
Posts: 97
crazyluv is an unknown quantity at this point
 



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
crazyluv is offline  
Old 05-08-2006, 11:56 AM THREAD STARTER               #5 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



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>
                  &nbsp;|&nbsp;
                  <div onClick="changemode('Local')" class="standardmode" id="Local">Local</div>
                  &nbsp;|&nbsp;
                  <div onClick="changemode('Images')" class="standardmode" id="Images">Images</div>
                  &nbsp;|&nbsp;
                  <div onClick="changemode('News')" class="standardmode" id="News">News</div>
                  &nbsp;|&nbsp;
                  <div onClick="changemode('Video')" class="standardmode" id="Video">Video</div>
                  &nbsp;|&nbsp;
                  <div onClick="changemode('Domains')" class="standardmode" id="Domains">Domains</div>
                  &nbsp;|&nbsp;
                  <div onClick="location.href='more'" class="standardmode" id="more">More &raquo;</div>
PoorDoggie is offline  
Old 05-08-2006, 12:44 PM   #6 (permalink)
NamePros Member
 
crazyluv's Avatar
Join Date: Jan 2005
Posts: 97
crazyluv is an unknown quantity at this point
 



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="&nbsp;<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>
Also you will have to give the sixBtn an ID for it to work.
__________________
AEInbetween
crazyluv is offline  
Old 05-08-2006, 02:52 PM THREAD STARTER               #7 (permalink)
Soon to be RICHdoggie!
 
PoorDoggie's Avatar
Join Date: Jan 2005
Location: UK
Posts: 2,408
PoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nicePoorDoggie is just really nice
 



That works perfectly. Thanks a lot! :-)
PoorDoggie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:26 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger