+ Reply to Thread
Results 1 to 9 of 9

Thread: JavaScript:Tutorial, Using an External Script

  1. #1
    TcM
    TcM is offline
    Code Warrior TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM's Avatar
    Join Date
    Aug 2006
    Posts
    11,461
    Blog Entries
    6

    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

  2. #2
    Programming God xtraze is an unknown quantity at this point
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    908
    I use it already and it help us to keep the code beautiful, perhaps.
    And easy to integrate js into sites.

  3. #3
    TcM
    TcM is offline
    Code Warrior TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM's Avatar
    Join Date
    Aug 2006
    Posts
    11,461
    Blog Entries
    6
    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!

  4. #4
    Programming God xtraze is an unknown quantity at this point
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    908
    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.

  5. #5
    TcM
    TcM is offline
    Code Warrior TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM's Avatar
    Join Date
    Aug 2006
    Posts
    11,461
    Blog Entries
    6
    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!

  6. #6
    Learning Programmer WillB is an unknown quantity at this point WillB's Avatar
    Join Date
    Apr 2007
    Location
    St. Cloud, Fl
    Age
    21
    Posts
    43
    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


  7. #7
    TcM
    TcM is offline
    Code Warrior TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM is a name known to all TcM's Avatar
    Join Date
    Aug 2006
    Posts
    11,461
    Blog Entries
    6
    Well that is encrypted not just hidden but nothing is 100% safe!

  8. #8
    Learning Programmer WillB is an unknown quantity at this point WillB's Avatar
    Join Date
    Apr 2007
    Location
    St. Cloud, Fl
    Age
    21
    Posts
    43
    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


  9. #9
    Newbie cryptokyle is an unknown quantity at this point cryptokyle's Avatar
    Join Date
    May 2009
    Location
    Singapore
    Posts
    11

    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. (Script) Copy content to clipboard, how?
    By annannienann in forum Visual Basic Programming
    Replies: 0
    Last Post: 06-19-2007, 05:20 PM
  2. Need help with proxy script please
    By TcM in forum PHP Forum
    Replies: 4
    Last Post: 05-16-2007, 09:54 AM
  3. Need Help With a Script
    By tfusion in forum PHP Forum
    Replies: 5
    Last Post: 04-14-2007, 07:35 PM
  4. calling C script from via Matlab
    By rattlepanos in forum C and C++
    Replies: 3
    Last Post: 02-16-2007, 11:06 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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