"HTML" "2" HTML introduces external file JS CSS

Source: Internet
Author: User

1 "Introduction JS

We just wrote the simple necessary HTML tag, never added a click event to the tag, this time the page adds events.

"is written to the HTML page and can be included in the

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4     <title>Yinana</title> 5<script  type= "Text/javascript">  6 D Ocument.write ("")  7 </ Script >           8     </Head>9 <Body> <script  type= "Text/javascript">11  document.write ("")  </script>            -     <Div> - This is the main content the     </Div> - </Body> - </HTML>

"Written in JS file

You want to Ah, when the JS logic too much when the HTML JS code too much, the page clutter does not say, maintenance is particularly inconvenient to modify, so intelligent human to the JS code and HTML code separated out,

Write the code to the file at the end of the. js file, and the HTML page introduces an external JS file.

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4     <title>Yinana</title>5      <script  src= "//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"  ></script>//introduction of external JS files 6     </Head>7 <Body>8     <Div>9 This is the main contentTen     </Div> One </Body> A </HTML>

2 "The introduction of CSS style" ibid. js "

The difference is that the labels they use are different css= </style> tags js= <script> tags

1 <HTML>2 <Head>3     <styletype= "Text/css">4 H1{Color:Red}5 P{Color:Blue}6     </style>7 </Head>8 9 <Body>Ten     <H1>Header 1</H1> One     <P>A paragraph.</P> A </Body> - </HTML>

External CSS files, ending with. css files

1 <HTML>2 <Head>3      <link  rel= "stylesheet"  href= "//cdn.bootcss.com/ Bootstrap/3.3.5/css/bootstrap.min.css "> 4 </Head>5 <Body>6     ......7 </Body>8 </HTML>

Ok

"HTML" "2" HTML introduces external file JS CSS

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.