View Single Post
Old 12-04-2008, 01:16 AM   #1 (permalink)
almac007
The Wanderer
 
Join Date: Dec 2008
Posts: 9
Thanks: 0
almac007 is on a distinguished road
Default Getting Error: is not a function when viewed in firefox - works in IE

Hi Guys,

Could someone please help me...

I am trying to fix up the site www.thinkpharmacy.com.au

On the right hand side of the home page there are some ads whcih are randomly generated. If you are browsing with Internet Explorer and you click one of these ads you get taken to that particular products page. everything works fine.

The problem i am having is that if i am browsing the site using Firefox and i click one of the ads all i get the following error message...

Error: gid("linkAds" + adsClicked).click is not a function
Source File: http://www.thinkpharmacy.com.au/js/ads.js
Line: 85


I cant understand why this is not working.

Here is a copy of the script ads.js that is being called.

javascript Code:
var xmlHttpAds
   
    function stateChangedAds()
        {
            if (xmlHttpAds.readyState==4)
            {
                //tamResp = xmlHttpAds.responseText.toString().length;
                //if(tamResp > 1){
                    openAds();
                    //alert(xmlHttpAds.responseText);
                    //xmlHttpAds = null;
                //}
            }
        }
       
    function GetxmlHttpObjectAds()
        {
        var xmlHttpAds=null;
        try
          {
          // Firefox, Opera 8.0+, Safari
          xmlHttpAds=new XMLHttpRequest();
          }
        catch (e)
          {
          // Internet Explorer
          try
            {
            xmlHttpAds=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            xmlHttpAds=new ActiveXObject("Microsoft.XMLHTTP");
            }
          }
        return xmlHttpAds;
    }
    var product = '';
    var adsClicked = '';
    var Urlproduct = '';
    function updateAds(id,product_id,Url){
        adsClicked = id;
        xmlHttpAds = GetxmlHttpObjectAds();
        var url = "";
        // DMD - 20060626 - get the host info
        // and make the URL
        switch(window.location.hostname)
        {
        case 'www.thinkpharmacy.com.au':
          var serverNameURL = "http://www.thinkpharmacy.com.au";
          break;   
        case 'tpo.thinkpharmacy.com.au':
          var serverNameURL = "https://tpo.thinkpharmacy.com.au";
          break;
        case 'www.productezine.com':
          var serverNameURL = "https://www.productezine.com/testserver/think";
          break;
        default:
          var serverNameURL = "";
        }
        //alert('passed in is ' + window.location.hostname);
        //alert('servernameurl is ' + serverNameURL);
        // var url="http://www.productezine.com/testserver/think/ajax/updateAds.php?id="+id;
        var url=serverNameURL+"/ajax/updateAds.php?id="+id; 
       
        var url2="http://www.thinkpharmacy.com.au/ajax/updateAds.php?id="+id;   
    //  alert('url2 is ' + url2);
       
        // DMD Edit
    //  alert(url);
        product = product_id;
        xmlHttpAds.onreadystatechange=stateChangedAds;
    //  alert('before redirect');
        xmlHttpAds.open("GET",url,true);
    //  alert('after redirect');
        xmlHttpAds.send(null);
        Urlproduct = Url;
    //  alert('URL Product is ' + Urlproduct);
    }

    function openAds(){
        if(Urlproduct == ""){
            gid("linkAdsProd"+adsClicked).click();
        }else{
            gid("linkAds"+adsClicked).click();
        }
    }


if anybody could help me out i would be very apprieciative.

Thanks in advance,

Almac007

Last edited by Wildhoney : 12-04-2008 at 01:53 AM.
almac007 is offline  
Reply With Quote