qbox Posted July 16, 2008 Share Posted July 16, 2008 When I open the site with FireFox everything work perfect but with IE I have error object doesn't support this property or metod...... Code = 0 etc. What is the problem. I only collect information like resolution, browser etc. and send them out. var warname = { init:function(){ ..... warname.onLoad(); }, onLoad:function(){ (i collect information here and send them) } } window.addEventListener("load", function() { warname.init(); }, false); Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 IE doesn't support window.addEventListener, use this instead: window.onload = function() { warname.init(); }; Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 I same error.... ??? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 can you post all the javascript then, cus the above works fine for me in IE6 with the window.onload Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 here it is I generate this code in PHP. I call that php like counter.php?site=mysite var myCounter = { init:function(mServer, mSesionID){ myCounter.Site=\"".$_GET['site']."\"; myCounter.Server=mServer; myCounter.SesionID=mSesionID; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-------------------------- myCounter.IP=\"".$_SERVER['REMOTE_ADDR']."\"; myCounter.trackingImage = new Image(); myCounter.OnLoad(); }, OnLoad:function(){ var newHref = document.createElement(\"a\"); var newImage = document.createElement(\"img\"); var scriptRef = myCounter.getScriptElement(); var data=new Date(); var mTZO=(typeof(data.getTimezoneOffset)!='undefined') ? data.getTimezoneOffset() : ''; newHref.href = \"http://\" + myCounter.Serve + \"/counter/Statistic.php?site=\" + myCounter.Site; newHref.target = \"_top\"; var mImage = \"http://\" + myCounter.Server + \"/counter/counting.php?site=\" + myCounter.Site; if (myCounter.IP != \"\") mImage += \"&ip=\"+myCounter.IP; mImage += \"&w=\"+window.screen.width; mImage += \"&h=\"+window.screen.height; mImage += \"&clr=\"+window.screen.colorDepth; mImage += \"&tzo=\" + mTZO; mImage += \"&lang=\"+escape(navigator.language ? navigator.language : navigator.userLanguage); mImage += \"&pg=\"+escape(document.location); mImage += \"&js=1\"; if(navigator.cookieEnabled) mImage += \"&co=1\"; else mImage += \"&co=0\"; if(navigator.cpuClass) mImage += \"&cpu=\"+navigator.cpuClass; else mImage += \"&cpu=0\"; newImage.border = \"0\"; newImage.src = mImage; newHref.appendChild(newImage); myCounter.trackingImage.src = mImage; }, getScriptElement:function() { var refScript=null; refScript = document.getElementById( \"myCounter\" ); if (refScript) return refScript; var pageScripts = document.getElementsByTagName(\"script\"); for(var i=0;i<pageScripts.length;i++) { if (pageScripts[i].src) { var mSource = pageScripts[i].src.toLowerCase(); if (mSource.indexOf(\"site=\" + myCounter.Site) > 0) return pageScripts[i]; } } return null; } } window.onload = function() { myCounter.init(); }; I want to use it to count and log visitors on my page. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 I don't get an error in IE6 on Windows XP. What are you testing in? Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 Im testing on local with 2 machines Linux and Windows Server Linux with XAMPP I didnt see error on linux with FireFox I se error only on Windows with IE not with FF. What can be wrong....? Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 Error details... Line: 74 Char: 1 Error: Object doesn't support this property or method Code: 0 URL: http://192.168.0.108/count/ line 74 is te } before window.onload.... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 16, 2008 Share Posted July 16, 2008 add a semi-colon after that close brace...so: } }; window.onload = function() { myCounter.init(); }; Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 Same again..... I will try to upload on a web server....semi-colo Quote Link to comment Share on other sites More sharing options...
qbox Posted July 16, 2008 Author Share Posted July 16, 2008 Strange... I didnt receive any error after uploading on a web server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.