同一個(gè)頁(yè)面引用多個(gè)js中可能會(huì)遇到一個(gè)問(wèn)題,同一個(gè)初始化方法在同一個(gè)頁(yè)面只能執(zhí)行第一個(gè)
例:
1.js:
window.οnlοad=function(){undefined
console.log(1)//打印1
}
2.js:
window.οnlοad=function(){undefined
console.log(2)//沒(méi)有執(zhí)行
}
頁(yè)面引用:
<script type="text/javascript" src="first.js"></script>
<script type="text/javascript" src="second.js"></script>