Home > Article > Web Front-end > How to use javascript
Methods to use javascript: 1. It can be introduced using script tags; 2. It can be embedded using script tags; 3. It can be bound in tag events; 4. It can be executed within a link; 5. It can be used in the address bar Enter the script to run.
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.
How to use javascript:
1. You can use the script tag to introduce
<script type="text/javascript" src="js文件路径"></script>
2. You can use the script tag to embed
<script type="text/javascript" > //js语句 </script>
3. You can bind the tag event
<div style="width:100px;height:100px;background:#ffaacc" onclick="alert('您点击了我')"></div>
4. You can execute it within the link
<a href="javascript:void(alert('我不走'))">点我</a>
5. You can enter the script in the address bar to run
Enter # in the address bar ##
javascript:document.innerHTML=''
Related free learning recommendations:
The above is the detailed content of How to use javascript. For more information, please follow other related articles on the PHP Chinese website!