Forum Moderators: open

Message Too Old, No Replies

Issues with javascript to control dropdown menus

         

suzanne

9:52 pm on Nov 22, 2004 (gmt 0)

10+ Year Member



Hi,

Got a quick question for a javascript expert that has me stumped. I am trying to track some campaigns on a site with a keyword tracking tool called keywordmax. It utilizes a standard single pixel tracking script to track clicks through to the landing pages.

I have been having trouble getting this to work. I spoke with the vendor, and they investigated and determined there was a script on the page that was interferring with their tracking tool. (They mirrored the site and discovered their tool worked as long as this code was removed...)

If anyone can shed some insight on to why this might be happening, as well as what could potentially be done to fix it -- that would be great. Thanks.

Here is the code on the site that appears to be causing the issue:

<script LANGUAGE="JavaScript">
<!--
var top=70
var br
if(navigator.appName == 'Netscape' && document.layers!= null){br="N";}
else if(navigator.appName == 'Microsoft Internet Explorer' && document.all!= null){br="IE";}
else{br=null}

//-->
</script>-->

adni18

2:11 am on Nov 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try defining your variables with a different name. perhaps also try, instead of just declaring br as a variable, assigning it a value, like 0 or null.

Rambo Tribble

3:22 am on Nov 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code appears to set two global variables when the page loads. The apparent purpose of the latter is to support code branching to accommodate different browsers. This suggests that elsewhere in your page, there may be code dependent on these values.

As adni18 suggests, changing variable names might have an effect, but you would need to make sure all the related invocations of that variable are synchronized.

Bernard Marx

9:11 am on Nov 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A couple of things:

1. Yes. Change the variable names. Most definately top. Using this as a global variable name makes

window.top
(points to top frame in heirarchy, or window itself) unavailable. Who knows, it may be needed.

2. The browser sniffer is very old. It the variable to null for essentially all browsers apart from Internet Explorer, since the only other option is Netscape 4 (document.layers).