Javascript-script label \ External JAVASCRIPT__ACM

Source: Internet
Author: User
Tags button type

Script label

<!--If you want to insert JavaScript into your HTML page, use the <script> tag. <script> and </script> will tell JavaScript where to start and end.
The lines of code between <script> and </script> contain JavaScript:
Just understand that the browser interprets and executes JavaScript between <script> and </script>.

Those old examples may use the type= "Text/javascript" in the <script> tag. There is no need to do so now. JavaScript is the default scripting language in all modern browsers and HTML5
-->

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title></title>

<body>
<script>
Alert ("My I-JavaScript");
</script>
</body>

Outside of JavaScript

<!---haha learned the call to the Java Script external file
Remember to refer to external files ...
-->

<!--
It is possible to refer to script files in Tip: External scripts cannot contain <script> tags.


You can also save the script to an external file. External files typically contain code that is used by multiple Web pages.

The file name extension for an external JavaScript file is. js.

To use an external file, set the. js file in the "src" attribute of the <script> label:
-->
<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html charset=utf-8"/>
</center>
<body>


<p id= "Demo" >a paragraph.</p>

<button type= "button" onclick= "MyFunction ()" > click here </button>
<button type= "button" onclick= "myfunction_1 ()" > Return </button>

<p><b> Note: </b>myfunction is saved in an external file named "Myscript.js". </p>

<script type= "Text/javascript" src= "Myscript.js" ></script>
<script type= "Text/javascript" src= "Myscript_1.js" ></script>

</body>


Tips:


function MyFunction ()
{
document.getElementById ("Demo"). Innerhtml= "I love my famliy!!!";
}

This is an external call to JavaScript, naming the file name MyScript and then calling it

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.