#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    How do I make a source file?


    I have this HTML document:
    Code:
    <HTML>
    <HEAD>
    <TITLE>HTML Document with Two JavaScript Sections</TITLE>
    </HEAD>
    <BODY>
    <SCRIPT LANGUAGE="JavaScript" SRC="sample.js">
    </script>
    <PRE>
    <SCRIPT LANGUAGE="JavaScript">
    document.writeln("Your order has been confirmed.");
    document.writeln("Thank you for your business.");
    </SCRIPT>
    </PRE>
    </BODY>
    </HTML>
    to call up this javascript source file:

    Code:
    <HTML>
    <HEAD>
    <TITLE>sample js</TITLE>
    </HEAD>
    <BODY>
    document.writeln("This message is from the javascript file.");
    </BODY>
    </HTML>
    But it doesnít work. What am I missing?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    26
    Rep Power
    0
    your javascript source
    file should contain only
    javascript, no html.
    So like this ...

    Code:
    document.writeln("This message is from the javascript file.");
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0
    Originally Posted by daveyerwin
    your javascript source
    file should contain only
    javascript, no html.
    So like this ...

    Code:
    document.writeln("This message is from the javascript file.");
    I was thinking it had to be something like that. The how-to book I am using isnít very clear. It canít explain anything in a consistent manner. Some things you are supposed to type are in a box with a caption, but then the rest of what goes with it can be on another page with neither box nor caption like it is something different entirely.
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Throw away the book, forget what you read and start over with a proper JavaScript resource.

    Pretty much every line of what you wrote down is either wrong or long obsolete or bad practice or all at the same time. This is how I wrote my very first home page in the late 90s. It has absolutely nothing to do with modern JavaScript in the 21st century.

    So the best advice I can give you is to not learn from that book. It's like trying to learn Oxford English from a Jamaican pothead.

    Comments on this post

    • DonR agrees
    • Kravvitz agrees
    • BarryG agrees
    • Nilpo agrees : Brilliant!
    Last edited by Jacques1; October 29th, 2013 at 09:16 AM.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    26
    Rep Power
    0
    Originally Posted by Jacques1
    Pretty much every line of what you wrote down is either wrong or long obsolete or bad practice or all at the same time. This is how I wrote my very first home page in the late 90s. It has absolutely nothing to do with modern JavaScript in the 21st century.
    Yes, exactly. This is how all
    FIRST pages are written.

    But with some help NOT
    the second.
  10. #6
  11. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Originally Posted by daveyerwin
    Yes, exactly. This is how all
    FIRST pages are written.
    Says who? What about teaching proper JavaScript so that people don't waste their time learning wrong and outdated techniques?



    Originally Posted by daveyerwin
    But with some help NOT
    the second.
    That's why I posted a link to the MDN.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    26
    Rep Power
    0
    Originally Posted by Jacques1
    This is how I wrote my very first home page in the late 90s.
    Originally Posted by Jacques1
    Says who? .
    Looks to me like
    Jacques1
    is who says?

IMN logo majestic logo threadwatch logo seochat tools logo