#1
  1. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,288
    Rep Power
    220

    Javascript element with or without attributes?


    Hello;

    Whichone is the correct way of using Javascript element?
    Code:
    <script src="s.js" type="application/javascript" language="javascript"></script>
    <script src="s.js" language="javascript"></script>
    <script src="s.js" type="application/javascript"></script>
    <script src="s.js"></script>
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,304
    Rep Power
    7174
    The language attribute is deprecated, but having it doesn't break anything.

    As of HTML5, the type attribute is optional. Even before HTML5, the script tag will still work without it.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  4. #3
  5. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,120
    Rep Power
    4308
    Good question.

    IE8 and older don't seem to recognize
    Code:
    <script src="s.js" type="application/javascript"></script>
    This is what I recommend and use myself:
    Code:
    <script src="s.js" type="text/javascript"></script>
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo