+ Reply to Thread
Results 1 to 9 of 9

Thread: JavaScript:Tutorial, Using an External Script

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    JavaScript:Tutorial, Using an External Script

    Introduction:-
    Here in this tutorial I will tell you how to use an External JavaScript file, so if you have a chunk of code that will be used in multiple pages, you will have to make one Script and then call it from the pages instead of making the same code over and over again!

    Solution:-
    Open a Text Editor and paste the following code and save it as <<Name>>.js I named it 'External Script.js', this is just a script that will show the time but here you can insert whatever you want!!

    Code:
    test = new Date()
    month = test.getMonth()
    month = (month * 1) + 1
    day = test.getDate()
    year = test.getFullYear()
    document.write(" ",month,"/",day,"/",year," ")
    And this code in the main HTML file:-

    Code:
    <SCRIPT SRC="External Script.js">
    </SCRIPT>
    Explanation:-
    Code:
    <SCRIPT SRC="External Script.js">
    </SCRIPT>
    Here we are just calling the External Script, instead of "External Script.js" make whatever name you named your script!

    A Preview:-
    None

    Conclusion:-
    As Always Feedback is welcome and the full source is attached!!
    Attached Files Attached Files

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    I use it already and it help us to keep the code beautiful, perhaps.
    And easy to integrate js into sites.

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by xtraze View Post
    I use it already and it help us to keep the code beautiful, perhaps.
    And easy to integrate js into sites.
    Yup I agree! I will keep your source code nice, but that would make it more easy for other users to understand it and copy it! I don't care how nice the source is, the worst the better for my site, so people wont understand it easily, the important is that I understand it!

  5. #4
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    To protect things right-click menu can be disabled and I have seen matters when I see the source of some certain websites, Firefox closes. Exit. in about 5 seconds or less.

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Well the Right-Click menu thing is just stupid I know 1000 ways on how to get round thats! thats just a waste of time!

    about the second.. hmm I never saw that , but lol I still can hack it its simple! Show me such website and I will show you its source... It's simple to bypass such thing!

  7. #6
    WillB's Avatar
    WillB is offline Learning Programmer
    Join Date
    Apr 2007
    Location
    St. Cloud, Fl
    Posts
    43
    Rep Power
    0
    Quote Originally Posted by Tcm9669 View Post
    Well the Right-Click menu thing is just stupid I know 1000 ways on how to get round thats! thats just a waste of time!

    about the second.. hmm I never saw that , but lol I still can hack it its simple! Show me such website and I will show you its source... It's simple to bypass such thing!
    What about a website that was written in Coldfusion? Or perhaps Flex?
    Everything in Life can be solved with an 'If/Else' statement.

    Life is like one big try/catch statement, nested within a loop.

    -Will


  8. #7
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Well that is encrypted not just hidden but nothing is 100% safe!

  9. #8
    WillB's Avatar
    WillB is offline Learning Programmer
    Join Date
    Apr 2007
    Location
    St. Cloud, Fl
    Posts
    43
    Rep Power
    0
    Quote Originally Posted by TheComputerMaster View Post
    Well that is encrypted not just hidden but nothing is 100% safe!
    Indeed!
    Everything in Life can be solved with an 'If/Else' statement.

    Life is like one big try/catch statement, nested within a loop.

    -Will


  10. #9
    cryptokyle's Avatar
    cryptokyle is offline Newbie
    Join Date
    May 2009
    Location
    Singapore
    Posts
    11
    Rep Power
    0

    Re: JavaScript:Tutorial, Using an External Script

    nice tutorial 5/5.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JavaScript:Tutorial, Redirect URL
    By TcM in forum JavaScript Tutorials
    Replies: 5
    Last Post: 01-17-2011, 04:49 AM
  2. The single most useful Javascript script ever written!
    By DarkLordoftheMonkeys in forum Classes and Code Snippets
    Replies: 4
    Last Post: 12-04-2009, 09:01 AM
  3. JavaScript:Tutorial, Your First Game!
    By TcM in forum JavaScript Tutorials
    Replies: 35
    Last Post: 06-11-2009, 01:27 PM
  4. Javascript - Good Day Script
    By Martijn in forum JavaScript and CSS
    Replies: 1
    Last Post: 01-02-2008, 10:18 PM
  5. JavaScript:Tutorial, Prompt
    By TcM in forum JavaScript Tutorials
    Replies: 2
    Last Post: 01-21-2007, 01:58 AM

Tags for this Thread

Bookmarks

Posting Permissions

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