StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > StatCounter.com > Bugs

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 12-11-2004, 08:47 PM
ttread
Guest
 
Posts: n/a
Default XHTML code forces newline

The StatCounter code for XHTML inserts a <div> tag in both the script output and the noscript code. Since <div> is a block-level element, it forces a newline if the visible StatCounter code appears in a line of text, for example, "You are visitor # "... the counter appears on the next line. This problem does not occur in the ordinary HTML version of the code.

It seems to have originated in this forum post: http://forum.statcounter.com/phpBB2/...ighlight=xhtml , where the <div> tag was added to provide a block-level container for the <a> tag inside the StatCounter code, so it would pass the stricter XHTML validator.

But... the <div> does not have to be inside the StatCounter code to contain the <a> tag, it can be outside anywhere in the document. The page author should do this to get the page to validate. I don't think that the visible counter should be block-level (like a paragraph or table) so it always starts a new line.

Solution: remove the <div> tags.

-Ted Treadwell
  #2  
Old 12-12-2004, 09:24 AM
Arne's Avatar
Arne Arne is offline
Moderator
 
Join Date: Sep 2004
Location: Lulea, Sweden
Posts: 5,464
Default

Yes, please! I second that!
  #3  
Old 05-25-2005, 01:43 PM
Lionel
Guest
 
Posts: n/a
Default

A site that I designed, http://www.benwhite.org.uk, is suffering from exactly that problem. The counter is at the bottom, and I hoped that it would be in the form "[email | 0005 | XHTML 1.0" etc.

In saying "remove the div tags", do you mean that removing the div tags would work, or that the developers need to remove the div tags?

Thanks,

Lionel
  #4  
Old 05-25-2005, 04:37 PM
ttread
Guest
 
Posts: n/a
Default

What I meant is that the StatCounter developers should remove the <div> element that is wrapping the script output in counter_xhtml.js (2 lines at bottom). It's not necessary for the XHTML validator and it's causing the counter to act as a block element on the page.

The <div> that is in the <noscript> portion of the code must remain, because the noscript tag can only contain block elements due to a stupid quirk of the HTML/XHTML DTDs. But that will only affect the small number of users with javascript turned off.
  #5  
Old 05-25-2005, 04:53 PM
Lionel
Guest
 
Posts: n/a
Default

Ah right, so evidently there is no way that I'll be able to get it inline until they do.
  #6  
Old 05-25-2005, 08:35 PM
Arne's Avatar
Arne Arne is offline
Moderator
 
Join Date: Sep 2004
Location: Lulea, Sweden
Posts: 5,464
Default

Quote:
Originally Posted by Lionel
Ah right, so evidently there is no way that I'll be able to get it inline until they do.
Well, if you make some style changes that don't affect the counter code it self, I don't think anybody at Statcounter objects if it better fits in on the page layout you have. I had a visible counter for a short time and made the changes, and even used a "statcounter" class for the counter.
  #7  
Old 05-25-2005, 09:41 PM
Lionel
Guest
 
Posts: n/a
Default

Well, what kind of changes? I can't say I know anything about java...
  #8  
Old 05-26-2005, 07:03 PM
Arne's Avatar
Arne Arne is offline
Moderator
 
Join Date: Sep 2004
Location: Lulea, Sweden
Posts: 5,464
Default

Quote:
Originally Posted by Lionel
Well, what kind of changes? I can't say I know anything about java...
Changing anything in the Javascript is a big no no, since it violate the Statcounter terms and conditions. But the counter and script is not affected if you move or remove the <div class="statcounter"> within the <noscript> portion, or just change it from block level to inline with <span class="statcounter">.

After all, there is not many XHTML coded pages, with visible counters where some text is wanted on the same level as the counter. So the need to change can't be so common
  #9  
Old 05-26-2005, 10:19 PM
Lionel
Guest
 
Posts: n/a
Default

I apologize. My knowledge of coding with XHTML is unfamiliar, and so I wouldn't know what to change, and what to. Could you spell it out for me? Thank you.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.