Solved

Test Page work in IE but not Firefox

Posted on 2012-03-23
2
312 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

861 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

22 Experts available now in Live!

Get 1:1 Help Now