Wanted: fix for script to work in Firefox

Discussion in 'JavaScript' started by Weirfire, Mar 8, 2006.

  1. #1
    I have a javascript image swap function that works in IE but doesnt work in FF. PM me for more details.
     
    Weirfire, Mar 8, 2006 IP
  2. edr

    edr Guest

    Messages:
    784
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    post your script and description of problem - be happy to give it a shot.
     
    edr, Mar 8, 2006 IP
  3. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #3
    And yet another of the one thousand of "not usual" or "very rare that occurs" issues of the "superior" buggy FireFox.

    Most javascript codes need to be optimized in order to work on that browser so as Edr said, post your code or try an update for that function here:

    http://www.dynamicdrive.com
     
    Mystique, Mar 8, 2006 IP
  4. Greg-J

    Greg-J I humbly return to you.

    Messages:
    1,844
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    135
    #4
    Not being able to get the same effect in FF that you can in IE is simply lack of knowledge or laziness on the part of the individual who's scripting it.

    And dynamicdrive is so 1999 it pains me to see that link ;)

    Can I ask what you're using the image swap for?
     
    Greg-J, Mar 8, 2006 IP
  5. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #5
    okay, I was talking to a firefox guru last night and he was getting totally different problems to me than the problems I was getting. This tells me I don't want to be using that script.

    I basically modded the script on this page http://www.alistapart.com/articles/imagegallery . The unusual thing is that the example on their page works in firefox but as soon as I changed it to fit my own links and info it stopped working in firefox.

    It could just be that my javascript skills are basic and I'm not coding something in the proper way.

    Here is my javascript

    function showPic (whichpic) {
    if (document.all) { document.getElementById = document.all; }
     if (document.getElementById) {
      document.getElementById('placeholder').src = whichpic.href;
      if (whichpic.scripttitle) {
       document.getElementById('scripttitle').childNodes[0].nodeValue = whichpic.scripttitle;
      } else {
       document.getElementById('scripttitle').childNodes[0].nodeValue  = whichpic.childNodes[0].nodeValue;
      }
    if (whichpic.scriptdescription) {
       document.getElementById('scriptdescription').childNodes[0].nodeValue = whichpic.scriptdescription;
      } else {
       document.getElementById('scriptdescription').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
      }
    if (whichpic.scripturl) {
       document.getElementById('scripturl').childNodes[0].nodeValue = "<a href=http://"+whichpic.scripturl+">"+whichpic.scripturl+"</a>";
      } else {
       document.getElementById('scripturl').childNodes[0].nodeValue = "<a href=http://"+whichpic.childNodes[0].nodeValue+">"+whichpic.scripturl+"</a>";
      }
        return false;
     } else {
      return true;
     }
    }
    
    Code (markup):
    and here is the html

    
    // looped to print all thumbnails
    $contents .= "<td><a onclick='return showPic(this)' href='".$fullsize."' scripttitle='".$title."' scriptdescription='".$description."' scripturl='".$url."' affurl='".$affurl."'><img src='".$thumb."' border='0'></a></td>";
    // end of loop
    
    
    // display of larger image with description attached
    <tr><td><img id='placeholder' src='".$ffullsize."' alt='' /></td>
    <td valign='top'>
    <table><tr><td style='font-size: 10px; background: #A0A0A0;'><b>Title</b></td></tr>
    <tr><td style='font-size: 10px'><p id='scripttitle'>".$ftitle."</p></td></tr>
    <tr><td style='font-size: 10px;background: #A0A0A0;'><b>Description</b></td></tr>
    <tr><td id='scriptdescription' style='font-size: 10px'>".$fdescription."</td></tr>
    <tr><td style='font-size: 10px;background: #A0A0A0;'><b>URL address</b></td></tr>
    <tr><td id='scripturl' style='font-size: 10px'><a href='http://".$faffurl."'>".$furl."</a></td></tr>
    </table>
    </td></tr>
    
    Code (markup):

    The script allows you to click a link and the information appears without the page refreshing. This was going to be used on a various number of projects but I'm thinking that it might be best to find another solution which will definitely work on both browsers.
     
    Weirfire, Mar 9, 2006 IP
  6. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #6
    What on earth is this red rep all about? lol

    Where in this thread does it look like I'm ungrateful? You get some strange characters on the internet. ;)
     
    Weirfire, Mar 12, 2006 IP