window.onload = function() {
script1;
script2;
script3;
......
}
function addLoadEvent(func)() {
var oldonload = window.onload;
if (typeof window.onload !="function") {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func;
}
}
}
<!DOCTYPE html>
<html>
<head>
<meta chaset="utf-8" />
<title>document.write</title>
<body>
<script>
<!--可以很方便的插入元素标签,尤其是字符串.但是它与网页设计应将行为(脚本)和结构(html标签)分离的原则-->
document.write("<p>This is inserted by document.write</p>");
</script>
</body>
</head>
</html>
<div id="testdiv">
</div>
window.onload = function() {
var testdiv = document.getElementById("testdiv");
testdiv.innerHTML = "<p>This is inserted by <em>innerHTML</em></p><en>";
}
window.onload = function() {
var testdiv = document.getElementById("testdiv");
var para = document.createElement("p");
testdiv.appendChild(para);
var context1 = doument.createTextNode("This is inserted by ");
para.appendChild(context1);
var emphasis = document.createElement("em");
para.appendChild(emphasis);
var context2 = document.createTextNode("method of domcore");
emphasis.appendChild(context2);
}
function insertAfter(newElement, targetElement) {
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
parent.appendChild(newElement);
} else {
targetElement.inserBefore(newElement, targetElement.nextSibling);
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有