Hobbies And Interests
Home  >> Science & Nature >> Science

How to Move a Script Code Into a JS File

A computer program is a series of instructions, compiled into machine code and then executed by the central processing unit -- or CPU. A script is slightly different, because it's not compiled into machine code, but instead read and executed by an interpreter. There are many different types of scripting language, but one of the most common is Javascript. It's typically used in Internet applications and can be written using a simple text editor.

Instructions

    • 1

      Open the text editor program, and create a new file. Name the file "Test.js" and save it.

    • 2

      Open the text file containing the Javascript code, within your text editor program. Find the lines where the script is located -- normally enclosed between "<script>" and "</script>" tags. Using the mouse, highlight the script, and press "CTRL" + "C" to copy it.

    • 3

      Open the "Test.js" file saved earlier. Press "CTRL" + "V" to paste the script into the file. Ensure that the "<script>" and "</script>" tags are not present in the file, and then save it. The script can now be executed from within HTML Web pages using the following lines:
      <script>
      language="javascript" src="Test.js">
      </script>


https://www.htfbw.com © Hobbies And Interests