Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Validation error because of Javascript ?

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Validation error because of Javascript ?

    Hi.

    I get a validation error when I add this script into the footer of the page:

    Code:
    <div id="footer">
      <div id="width"> <span class="floatLeft">
        <!-- Begin Shinystat Free code -->
    <script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=username"></script>
    <noscript>
    <a href="http://www.shinystat.com" target="_top">
    <img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=username" alt="website counter" border="0"></a>
    </noscript>
    <!-- End Shinystat Free code -->
        </span> <span class="floatRight">Copyright © 2009  - All rights reserved.</span> </div>
    </div>
    It's because of the code that is between the <noscript> tags.

    The page is valid XHTML if I take out:

    Code:
    <noscript>
    <a href="http://www.shinystat.com" target="_top">
    <img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=username" alt="website counter" border="0"></a>
    </noscript>
    The image of the counter is still loading but I'm not sure if it got some effect on the counter even though it seems to work.

    Could I load this script with an external javascript file?

    And if yes, what is the right way to do it?

    Please give me some advise here.

    Any feedback is very much appreciated,
    Last edited by Cheng; 04-07-2009 at 12:05 PM.
    Cheng

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You should be using HTML 4.01 Strict on the Web right now, since IE doesn't have support for XHTML.

    The target attribute is not valid HTML (or XHTML). It was deprecated in HTML4, and removed from the Strict DTD.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Hi Twey.

    Thanks for your reply.

    I changed the doctype to HTML strict but there is still the validation error for <noscript>

    Even without the target attribute it still comes up with the <noscript> error.

    Do got any idea what can be done about it?
    Cheng

  4. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Remove the highlighted:
    Code:
    </noscript>
    <!-- End Shinystat Free code -->
        </span> <span
    Good luck!

  5. #5
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Snookerman View Post
    Remove the highlighted:
    Code:
    </noscript>
    <!-- End Shinystat Free code -->
        </span> <span
    Good luck![/CODE]
    .......sorry, but it didn't work.

    It put everything out of perspective.

    I applied doctype HTML Transitional and everything is fine except for this one validation error:

    PHP Code:
    Line 98Column 14document type does not allow element "NOSCRIPT" heremissing one of "APPLET""OBJECT""MAP""IFRAME""BUTTON" start-tag 

        
    <noscript>

    The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element

    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>"inside an inline element (such as "<a>""<span>", or "<font>"). 
    I wonder if it causes any harm to the counter if I leave the whole noscript part out.

    Without it the counter is showing up same as with the noscript applied and it seems to count as well but as I said I'm not sure if it is ok to take that part out or not.......
    Last edited by Snookerman; 04-30-2009 at 06:39 PM. Reason: fixed [/quote] tag
    Cheng

  6. #6
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    I think what you have done is wrapped everything in a <span> tag which is an inline element. Please post the entire code or a link to the site and I'll tell you what to remove.

  7. #7
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Snookerman View Post
    I think what you have done is wrapped everything in a <span> tag which is an inline element. Please post the entire code or a link to the site and I'll tell you what to remove.
    .......Hi Snookerman.

    Attached you'll find a txt file which contains the HTML code.

    I really do appreciate your effort to help.

    Thanks a lot.......
    Cheng

  8. #8
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Just as I thought, you have everything wrapped inside a <span> tag:
    Code:
    <div id="footer">
      <div id="width"> <span class="floatLeft">
        <!-- Begin Shinystat Free code -->
        <script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=benjapakee"></script>
        <noscript>
        <a href="http://www.shinystat.com" target="_top"> <img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=benjapakee" alt="Free blog counters" border="0"></a>
        </noscript>
        <!-- End Shinystat Free code -->
        </span> <span class="floatRight">Copyright © 2009 by Tommy's Enterprises - All rights reserved.</span> </div>
    </div>
    Change that to a div container:
    Code:
    <div id="footer">
      <div id="width"> <div class="floatLeft">
        <!-- Begin Shinystat Free code -->
        <script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=benjapakee"></script>
        <noscript>
        <a href="http://www.shinystat.com" target="_top"> <img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=benjapakee" alt="Free blog counters" border="0"></a>
        </noscript>
        <!-- End Shinystat Free code -->
        </div> <span class="floatRight">Copyright © 2009 by Tommy's Enterprises - All rights reserved.</span> </div>
    </div>
    Note that you might have to change the CSS code for this element if it targets the span tag specifically.

    Good luck!

  9. The Following User Says Thank You to Snookerman For This Useful Post:

    Cheng (04-07-2009)

  10. #9
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    ......I tried that but it didn't work unless I misunderstood you.

    I changed the footer to:

    Code:
    <div id="footer">
      <div class="floatLeft">
        <!-- Begin Shinystat Free code -->
        <script type="text/javascript" language="JavaScript" src="http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=benjapakee"></script>
        <noscript>
        <a href="http://www.shinystat.com" target="_top"> <img src="http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=benjapakee" alt="Free blog counters" border="0"></a>
        </noscript>
        <!-- End Shinystat Free code -->
        </div> <span class="floatRight">Copyright © 2009 by Tommy's Enterprises - All rights reserved.</span> </div>
    </div>
    </body>
    </html>
    This destroys the whole footer which is fixed to the bottom of the page by the way.......
    Cheng

  11. #10
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Now you removed a div with the id of width. Just copy and paste what I posted.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •