"; 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?
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.
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('hello world3')";> </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!