469,625 Members | 1,059 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Whats wrong with this code?

Got some code that works in IE, when I run in FF nothing happens. If I debug the code in venkman or firebug it magically works. But if I just run it in Firefox nothing happens?

any Ideas?


HTML Anchor tag
Expand|Select|Wrap|Line Numbers
  1. <a id="143066" name="143066" href="page.php" onclick="return trackclick(this.href, this.name, '143066 anchor text:page1');">Page 1</a>
tracker.js thats included in the head. using:
<script type="text/javascript" src="js/tracker.js">
</script>
Expand|Select|Wrap|Line Numbers
  1. function trackclick(url, aid, atxt) {
  2.     if(document.images){ 
  3.           var img = new Image();
  4.           var ClickTrack = "tracker.php";
  5.           var image_src = ClickTrack+"?url="+url+"&aid="+aid+"&atxt="+atxt+"&loc="+document.location;
  6.             img.src = image_src;
  7.         }
  8.     return true;
  9. }


I know the PHP works. It works fine with IE. but here it is:
Expand|Select|Wrap|Line Numbers
  1. include($_SERVER['DOCUMENT_ROOT']."includes/global.php");
  2.  
  3. $ip                = getenv("REMOTE_ADDR");
  4. $userAgent        = getenv("HTTP_USER_AGENT");
  5. $clicktime        = date("Y-m-d G:i:s T");
  6. $url            = $url;
  7. $url_id         = $aid;
  8. $anchor_text    = $atxt;
  9. $loc            = $loc;
  10.  
  11. $data = array('ip' => $ip, 'useragent' => $userAgent, 'clicktime' => $clicktime, 'url' => $url, 'url_id' => $url_id, 'anchor_text' => $anchor_text, 'loc' => $loc);
  12.             $db->loadModule('Extended');
  13.             $db->extended->autoExecute('logger', $data, MDB2_AUTOQUERY_INSERT);
  14.  
  15.  
I know this is a FF compatibility issue, just can't figure it out.
Dec 19 '07 #1
4 919
drhowarddrfine
7,435 Expert 4TB
Possibly not the problem but id names may not begin with a number.
Dec 20 '07 #2
Changed the anchor tag, now begins with a letter. Still doesn't work in FF.

[HTML]<a id="nev003" name="nev003" href="page.php" onclick="return trackclick(this.href, this.name, 'nev003 anchor text:nev003');">Page 1</a>[/HTML]

Any other ideas?
Dec 20 '07 #3
Anybody else have any ideas?
Dec 20 '07 #4
acoder
16,027 Expert Mod 8TB
document.location should be document.URL or window.location.
Dec 22 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Chris Geerdink | last post: by
4 posts views Thread by asdf | last post: by
1 post views Thread by aa | last post: by
3 posts views Thread by mahsa | last post: by
4 posts views Thread by blah | last post: by
5 posts views Thread by islayer | last post: by
5 posts views Thread by hiqu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.