javascript
JavaScript函数的调用
后來檢查發(fā)現(xiàn)在onload與onunload事件所對應(yīng)的方法調(diào)用時,沒有打括號,造成的。
錯誤的代碼:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標(biāo)題文檔</title>
<script language="JavaScript">
//alert("這是第一個JavaScript例子。");
//alert("歡迎你進入JavaScript世界!");
//alert("今后我們將共同學(xué)習(xí)JavaScript知識!");
//document.write("這是賽迪網(wǎng)互動學(xué)校");
//document.close();
function loadfrom(){
?alert("加載頁面!");
?}
?
function unloadfrom(){
?alert("關(guān)閉頁面!");
?}
</script>
</head>
<body? OnLoad="loadfrom" OnUnload="unloadfrom">
<p> </p>
</body>
</html>
正確的代碼:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標(biāo)題文檔</title>
<script language="JavaScript">
//alert("這是第一個JavaScript例子。");
//alert("歡迎你進入JavaScript世界!");
//alert("今后我們將共同學(xué)習(xí)JavaScript知識!");
//document.write("這是賽迪網(wǎng)互動學(xué)校");
//document.close();
function loadfrom(){
?alert("加載頁面!");
?}
?
function unloadfrom(){
?alert("關(guān)閉頁面!");
?}
</script>
</head>
<body? OnLoad="loadfrom()" OnUnload="unloadfrom()">
<p> </p>
</body>
</html>
轉(zhuǎn)載于:https://www.cnblogs.com/zqonline/archive/2007/10/01/912404.html
總結(jié)
以上是生活随笔為你收集整理的JavaScript函数的调用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: SVG脚本编程简介(转)
- 下一篇: 索尼爱立信M608C使用心得!