Solved

Test Page work in IE but not Firefox

Posted on 2012-03-23
2
308 Views
Last Modified: 2012-03-23
I built the attached test page.  I thought it was working, but when I tries it in Firefox not all of it functions.  The favoite buttons don't work.  Here is the page
http://www.glassdivider.com/Wedding_test.html

Here is the script:

<script type="text/javascript">
function LGpic(id){
      var picid = "pic"+[id];
      var txtid = "txt"+[id];
      var image =document.getElementById(picid).src;
      var text =document.getElementById(txtid).innerHTML;
document.getElementById('Largepic').src = image;
document.getElementById('txtLP').innerHTML = text;
}
function fav1(){
      var bigtxt = document.getElementById('txtLP').innerHTML;
      var bigpic = document.getElementById('Largepic').src;
      document.getElementById('Favorite_pic1').src = bigpic;
      document.getElementById('ftxt1').innerHTML = bigtxt;
}
function fav2(){
      var bigtxt = document.getElementById('txtLP').innerHTML;
      var bigpic = document.getElementById('Largepic').src;
      document.getElementById('Favorite_pic2').src = bigpic;
      document.getElementById('ftxt2').innerHTML = bigtxt;
}
function fav3(){
      var bigtxt = document.getElementById('txtLP').innerHTML;
      var bigpic = document.getElementById('Largepic').src;
      document.getElementById('Favorite_pic3').src = bigpic;
      document.getElementById('ftxt3').innerHTML = bigtxt;
}
function fav4(){
      var bigtxt = document.getElementById('txtLP').innerHTML;
      var bigpic = document.getElementById('Largepic').src;
      document.getElementById('Favorite_pic4').src = bigpic;
      document.getElementById('ftxt4').innerHTML = bigtxt;
}
</script>

Thanks for the help.
0
Comment
Question by:jws2bay
2 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37758785
please debug using FireBug...
Try to avoid document.getelementbyid and try using jquery for all DOM related activity.
Its tailor made for cross browser solutions....

here are the corrections to fav1:-

function fav1(){
      var bigtxt = document.getElementById('txtLP').innerHTML;
      var bigpic = document.getElementById('Largepic').src;
      document.getElementById('favorite_pic1').src = bigpic;
      document.getElementById('ftxt1').innerHTML = bigtxt;
}

marked bold is modified, letter f of favorite should be smaller.
Fire fox search is case sensitive..

Make the other changes accordingly...
but just try to use JQuery and be specific with case when you work in JS.
0
 

Author Closing Comment

by:jws2bay
ID: 37759403
Thanks for the help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now