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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2003
    Location
    Texas
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [help] how to embed a .js file inside html?

    ok i have this problem with embedding a .js file inside the header file of HTML..I don't know whether to use ..

    <script language="javascript" href="file.js"></script>

    or

    <script language="javascript" src="file.js"></script>

    or

    neither.


    thanks in advance.^^

    ~fat~

  • #2
    Regular Coder
    Join Date
    Mar 2003
    Posts
    176
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <script type="text/javascript" language="javascript" src="myJsFile.js"></ script>
    you could specify the js version...

    language="javascript1.1"

    ...to make sure an ancient browser doesnt throw an error because it (e.g NN2 ) cant access an external file. I doubt many people bother with it now.
    You can also specify js language versions for (somewhat) later browser versions to prevent them reading scripts with code they wont understand....as i say, im not sure that many people bother with it though.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ...

    type="text/javascript"

    what purpose does this serve? I have a lot of external javascript activity on websites I designed. is there someone who isn't able to view my stuff if this isn't there?
    If at first you don't succeed, spend more time online researching javascript!
    Beck

  • #4
    Regular Coder
    Join Date
    Mar 2003
    Posts
    176
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No (well not in the near future anyway), the type="text/javascript' is required by the HTML standard for the Script Element

    The 'language' attribute is deprecated in place of the 'type' atribute.
    Last edited by HairyTeeth; 04-09-2003 at 11:47 AM.

  • #5
    New to the CF scene
    Join Date
    Apr 2003
    Location
    Texas
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    what versions of javascript are there?? because i was reading some books about it..and they just say most browser will recognize the term "javascript" .. so please help me :^)

    by the way, thanks for the help! i realized that problem is not that part..it's something else deep within the code itself. thanks tho!

    ~fat~

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

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