Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post

    can't get my webpage validated due to javascript

    I'm trying getting one of my webpage XHTML 1.0 Strict.

    There is only one error left, namely:

    document type does not allow element "br" here

    at this line:

    Code:
    container.innerHTML = result.translation.replace(/mdw/g, '<br />');
    Obviously this is part of my javascript coding, but it's where the validation goes wrong.

    I can't put the javascript in an external file since several javascript variables are getting filled by php.

    I've tried several options, but I ain't a javascript expert.. so perhaps someone can help me out.

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    did you try with

    container.innerHTML = result.translation.replace(/mdw/g, '<br>'); ?

  • #3
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post
    Yes I tried that, the validation goes wrong on the < > characters.

  • #4
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    .....
    Last edited by xelawho; 09-22-2011 at 02:58 AM. Reason: realized I have no idea what I'm talking about, really...

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Last edited by _Aerospace_Eng_; 09-22-2011 at 03:49 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,374
    Thanks
    11
    Thanked 592 Times in 572 Posts
    use external scripts with strict. or don't use strict; it's not as good at js as transitional anyway...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #7
    New Coder
    Join Date
    Mar 2010
    Posts
    30
    Thanks
    0
    Thanked 1 Time in 1 Post
    Aerospace is correct, enclose your javascript code in CDATA tags.

    Code:
    <script type="text/javascript">
      <![CDATA[
        // your javascript code
      ]]>
    </script>


  •  

    Posting Permissions

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