How do I put a script in a page?

Source: Internet
Author: User
This chapter describes how to place JavaScript scripts on a page.
The following is a simple example of how to write text with a JS script:
==============================================
Scripting code:
<script language= "JavaScript" >
document.write ("<font color= ' red ' > This is the red word </FONT>")
</SCRIPT>
==============================================
Effect: This is the red Word
==============================================
JavaScript and Java are different. Java is an object-oriented programming language developed by Sun, which can be used to write stand-alone Java programs, or to write
Java applet is a small program, it is mainly for professional programmers, not ordinary users, and generally you do not see its source code
Of One of the most closely related to the home page is the Java applet, its source code can be compiled to execute, you need to use the applet code into HTML,
Load execution through a browser. Because it is loaded for a long time, if too many Java applets in the Web page can cause the page to download very slowly. So that your visitors
Perhaps there is not too much patience waiting for the page to be fully displayed and will leave.
What we're talking about here is JavaScript, and you can think of it as a Java "pro
Qi ", it is actually a scripting language, is textual in nature, so we can see its source code, very easy to learn and understand, slightly programming experience
People can quickly change and modify their source code to adapt to their own pages, is a real sense of the user-oriented scripting language. JavaScript scripting code
Generally inserted into the HTML Often fast. Now all the more excellent sites have been using JavaScript technology more or less, without exception.
Note that JavaScript scripts must be browser-enabled if the browser does not support JavaScript or browser JavaScript options
It cannot be performed without opening. As an example of IE browser, the way to open JavaScript is to allow Java to be run in view-options-Advanced.
How do I write JavaScript?
First, JavaScript is not HTML. It is a piece of text in HTML. The syntax of HTML is not very rigorous, is actually very loose, such as you in the text
Adding a few spaces between paragraphs is not much different to HTML, which is why most HTML languages don't have to be written on the same line
Write on one line this doesn't make any difference to HTML.
JavaScript syntax rules are much stricter. If you write this example: document.write ("<font color= ' Red" > This is red

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.