Hey all! I've tried many stat counters but all of them aren't xhtml valid which is pretty annoying...which one can you recommend? regards
If the counter originates within your own server, you could just make the changes to the script necessary to have it produce valid XHTML. A counter typically requires very little code to display. I have to think this wouldn't take more than a minute or two.
Hey! The codes are: (2 counters) <!-- Start of StatCounter Code --> <script type="text/javascript" language="javascript"> var sc_project=1532004; var sc_invisible=1; var sc_partition=14; var sc_security="509cc2d0"; var sc_remove_link=1; </script> <script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><img src="http://c15.statcounter.com/counter.php?sc_project=1532004&java=0&security=509cc2d0&invisible=1" alt="hit counter code" border="0"> </noscript> <!-- End of StatCounter Code --> <!-- Start CounterSpot Code --> <script language="javascript"> var data, p; var agt=navigator.userAgent.toLowerCase(); p='http'; if((location.href.substr(0,6)=='https:')||(location.href.substr(0,6)=='HTTPS:')) {p='https';} data = '&r=' + escape(document.referrer) + '&n=' + escape(navigator.userAgent) + '&p=' + escape(navigator.userAgent) + '&g=' + escape(document.location.href); if(navigator.userAgent.substring(0,1)>'3') {data = data + '&sd=' + screen.colorDepth + '&sw=' + escape(screen.width+ 'x'+screen.height)};document.write('<a href="http://www.counterspot.com/stats.php?i=1184" target="_blank" >'); document.write('<img border=0 hspace=0 '+'vspace=0 alt="free counters" src="http://www.counterspot.com/counter.php?i=1184' + data + '">'); document.write('</a>'); </script><noscript><a href="http://www.counterspot.com" target="_blank" >free counters</a></noscript> <!-- End CounterSpot Code --> Code (markup): regards
See if this works for you: <!-- Start CounterSpot Code --> <script language="javascript"> var data, p; var agt=navigator.userAgent.toLowerCase(); p='http'; if((location.href.substr(0,6)=='https:')||(location.href.substr(0,6)=='HTTPS:')) {p='https';} data = '&r=' + escape(document.referrer) + '&n=' + escape(navigator.userAgent) + '&p=' + escape(navigator.userAgent) + '&g=' + escape(document.location.href); if(navigator.userAgent.substring(0,1)>'3') {data = data + '&sd=' + screen.colorDepth + '&sw=' + escape(screen.width+ 'x'+screen.height)};document.write('<a href="http://www.counterspot.com/stats.php?i=1184" onclick="window.open(http://www.counterspot.com/stats.php?i=1184);return false;" >'); document.write('<img style="border:none" alt="free counters" src="http://www.counterspot.com/counter.php?i=1184' + data + '" />'); document.write('</a>'); </script> <!-- End CounterSpot Code --> Code (markup): I only altered the second portion. Keep the first portion in place. Depending on the level of XHTML validity you are seeking, you may need to place all of this information into external files and call it in that way, but see if this does what you need it to do, and if not, copy/paste the validation errors you're seeing
hey! it didnt work these are the errors: http://validator.w3.org/check?uri=http://aisolutions.ch/showoff/websites/portfolio/ BTW what do you mean by: regards
The validator found one 'real' error, the script tag should be <script type="javascript">. Otherwise, the validator does not ignore the script and tries to validate it as html. Try wrapping the script in html comments[1]: <script type="javascript"> //<!-- ... //--> </script> Code (markup): cheers, gary [1] check that a double hyphen (--) does not appear in the script, as that will end the html comment.
Use www.statcounter.com They offer xhtml compaint code also. In setup of the code check the xhtml option... enjoy
That was my fault. I should have been more attentive with this line: <script language="javascript"> which should be <script type="text/javascript"> If you move all of the information within this ste of script tags into an external file, your problems are solved. So, place this on your page: <script type="text/javascript" src="counter.js"></script> And take all of the actual scripting, stick it into a file, and call it counter.js.
Hey thanks all! especially the_pm! That was very helpful...also for future projects...thank you! I've now moved everything to an external file and it works perfect! thanks!