当前位置:网站首页>2、 Three ways to write JS code
2、 Three ways to write JS code
2022-06-13 08:33:00 【001128XY】
Write JS Three ways to code
1、 Inline
Format :
<button onclick="alert('hello js');"> Am I </button>
2、 Inside JS( In page )
Format :
<!-- type="text/javascript" Indicates that the type of script you write is JS -->
<!-- If you don't write , The default is type="text/javascript" -->
<script type="text/javascript"> alert("hello js"); </script>
Be careful : Advice on body Bottom , Because the code is executed from top to bottom , stay head The label says JS Code can't get body The elements of the label , If you want to write in front , Think again HTML Elements in can be used window.onload.
3、 external JS( Outer chain )
Format :
<script type="text/javascript" src="out.js"></script>
Be careful : Outer chain script You cannot write in a code block js Code , Even if it's written, it won't execute ;
<script type="text/javascript" src="out.js"> alert("helo js~"); // Will not be executed </script>
边栏推荐
- 学习记录4: einops // cudnn.benchamark=true // hook
- Methods of importing and exporting settings in Altium Designer
- Buuctf web (III)
- JS - array de duplication in the array object case
- Svg text stroke effect
- 第115页的gtk+编程例子——最简单的进度条2附带使用Anjuta写gtk程序的步骤
- About redis encapsulation tool class using distributed locks
- 微服务项目搭建二:数据库设计
- Determination of ranking
- Four ways to install MySQL in Linux
猜你喜欢
Microservice system architecture construction I: Environment Construction
redis.exceptions.ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.
0.一些自己初学Solidworks的疑惑
About redis encapsulation tool class using distributed locks
File upload question type
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory
Start from scratch - implement the jpetstore website -1- establish the project framework and project introduction
ERP basic data concept
Learning record 4:einops / / cudnn benchamark=true // hook
微服务项目搭建三:自动生成代码
随机推荐
Gtk+ programming example on page 115 - simplest progress bar 2 with steps to write GTK program using anjuta
How to efficiently manage commodities and inventory in the beverage wholesale industry
微服务项目搭建三:自动生成代码
Redis subscribe connection timeout interrupt problem solution
How to hide tabs in nailing applet
Call to undefined function think\captcha\imagettftext()
WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]
About redis encapsulation tool class using distributed locks
Logstash configuration reference article
微服务系统架构搭建一:环境搭建
JD commodity detail interface, JD detail page interface, baby detail page interface, commodity attribute interface, commodity information query, commodity detail interface, H5 details, JD app details,
天猫商品详情接口,天猫商品优惠券接口,天猫api接口,天猫价格监控接口,天猫比价接口,品牌维权接口,天猫销量api接口,接口代码可对接数据分析业务,品牌维权,比价业务,行业分析业务接口代码分享
CCNP_ BT-MGRE
Dest0g3 520 orientation
Mongodb test case
Microservice project construction III: automatic code generation
Microservice Project Construction II: database design
Homestead environment setup
Dest0g3 520迎新賽
Using KVM to create three virtual machines that can communicate with local area network