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 4 of 4

Thread: Javascript code

  1. #1
    New Coder
    Join Date
    Aug 2010
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Javascript code

    Hi,

    Which is the difference between to use "<!-- //-->" inside the script or not?


    <script language=JavaScript>
    <!--
    function stopError() {
    return true;
    }
    window.onerror = stopError;
    // -->
    </script>



    <script language=JavaScript>

    function stopError() {
    return true;
    }
    window.onerror = stopError;

    </script>


    Any advice is welcome!!

    stickers

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    966
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by stickers View Post
    Hi,

    Which is the difference between to use "<!-- //-->" inside the script or not?









    Any advice is welcome!!

    stickers
    I think the difference is the number of chars you must type.
    But I'm not so good with objects.

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
    The <!-- and //--> comment (hiding) tags have not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that you are looking at ancient and perhaps unreliable code.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • Users who have thanked Philip M for this post:

    stickers (09-02-2010)

  • #4
    Regular Coder
    Join Date
    Aug 2010
    Posts
    966
    Thanks
    19
    Thanked 211 Times in 209 Posts
    Quote Originally Posted by Philip M View Post
    <script language=javascript> is long deprecated and obsolete. Use <script type = "text/javascript"> instead.
    The <!-- and //--> comment (hiding) tags have not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that you are looking at ancient and perhaps unreliable code.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    sorry
    Last edited by DaveyErwin; 09-02-2010 at 08:14 PM. Reason: Im an as sho l e


  •  

    Posting Permissions

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