"; 2. Write it in the script tag pair, with the syntax ""; 3. Use the "" statement."/> "; 2. Write it in the script tag pair, with the syntax ""; 3. Use the "" statement.">

Home  >  Article  >  Web Front-end  >  What are the three ways to use javascript?

What are the three ways to use javascript?

青灯夜游
青灯夜游Original
2021-10-28 16:51:243028browse

Method: 1. Use it in the event attribute of the tag, the syntax "8748f9ad597df30f67f230c2f414f1a4"; 2. Write it in the script tag pair, the syntax "9eea5c1f09471d93f466f7b678f314f3"; 3. Use the "8f46e005a9c1806906f3c7d0c67a68462cacc6d41bbb37262a98f745aa00fbf0" statement.

What are the three ways to use javascript?

The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.

The usage of js is similar to css:

1. Inline

Use "";

<body onload="alert(&#39;hello world3&#39;)";>
</body>
## in the label attribute

#2. Embedded

Use script tag directly

<script>
alert("hello world2");
</script>

3. Linked

Use dc6ac8f2315a7115d9939bd34c8b8db6Introducing external .js files

<script type="text/javascript" src="js学习.js"></script>

js file code

alert("hello world 1");

[Recommended learning:

javascript advanced tutorial

The above is the detailed content of What are the three ways to use javascript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn