Home > Web Front-end > JS Tutorial > body text

如何让页面加载完成后执行js_javascript技巧

WBOY
Release: 2016-05-16 17:31:03
Original
1095 people have browsed it

javascript 当页面dom模型加载完成后才执行javascript
不能使用
加上 defer 等于在页面完全在入后再执行,相当于 window.onload ,但应用上比 window.onload 更灵活

复制代码 代码如下:





无标题文档



先看到这段话  然后再执行上面的 JS  如果去掉上面的 defer="defer" 那么会先执行JS  在看到这段话


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!