View Single Post
Old 12-04-2008, 04:15 AM   #5 (permalink)
almac007
The Wanderer
 
Join Date: Dec 2008
Posts: 9
Thanks: 0
almac007 is on a distinguished road
Default

Hi Wildhoney,

Thanks for all your help with this.

I have rewritten the code but now i cant get it to work in either IE or Firefox. I keep getting the follwoing error.

Error: updateAds is not defined
Source File: javascript:updateAds('73','0','/prodinfo.php?id=1252')
Line: 1

Its probably something really simple :(

here is a copy of the rewritten code.

var xmlHttpAds =
{

var product = '';
var adsClicked = '';
var Urlproduct = '';

stateChangedAds: function()
{
if (xmlHttpAds.readyState==4)
{
openAds();
}
},
GetxmlHttpObjectAds: function()
{
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;
},
updateAds: function(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 = "https://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 = "";
}

var url=serverNameURL+"/ajax/updateAds.php?id="+id;

product = product_id;
xmlHttpAds.onreadystatechange=stateChangedAds;
xmlHttpAds.open("GET",url,true);
xmlHttpAds.send(null);
Urlproduct = Url;
},
openAds: function()
{
if(Urlproduct == ""){
gid("linkAdsProd"+adsClicked).click();
}else{
gid("linkAds"+adsClicked).click();
}
}
}


thanks again for your help.
almac007 is offline  
Reply With Quote