Method: 1. Use the "" statement; 2. Embed js code inside the script tag pair; 3. Write js code in the onclick attribute of the HTML tag.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
JavaScript is a high-level scripting language that belongs to the Internet. It has been widely used in Web application development. It is often used to add various dynamic functions to web pages and provide users with smoother and more beautiful browsing effects. Usually JavaScript scripts realize their functions by embedding them in HTML.
Three ways to introduce javascript:
The first one: external introduction
<script type="text/javascript" src="路径/文件名.js"></script>
If a js file is imported from outside the script tag, no more js programs can be written in this tag
Second: Internal introduction
<script type="text/javascript"> //js代码 alert('js hello world!');//弹窗 </script>
Three types: Inline introduction
<input type="button" value="行内引入方式" onclick="javascript:alert('我是行内引入方式');">
[Related recommendations: javascript learning tutorial]
The above is the detailed content of What are the three ways to introduce javascript?. For more information, please follow other related articles on the PHP Chinese website!