第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

我寫了兩個函數(shù),一個打開窗口,一個關(guān)閉窗口,為什么不起作用呢?

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
? <script type="text/javascript">
? var mywin;
? function openWindow(){
???? mywin=window.open("http://idcbgp.cn",'_blank');
? }
? function closeWindow(){
???? mywin.close();????? ?
? }
? </script>
</head>
<body>
<form>
?? <input type="button" value="新建窗口" onclick="closeWindow()" />
?? <input type="button" value="關(guān)閉窗口" onclick="closeWindow()" />
</form>
</body>
</html>

正在回答

3 回答

在函數(shù)外聲明的變量相當(dāng)于全局變量了 兩個函數(shù)都可以使用

0 回復(fù) 有任何疑惑可以回復(fù)我~

你把第一個按鈕中的“closewindow()”函數(shù)替換成openwindow()就可以了

<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/>
<title>close()</title>
??<script?type="text/javascript">
??var?mywin;
??function?openWindow(){
?????mywin=window.open("http://idcbgp.cn",'_blank');
??}
??function?closeWindow(){
?????mywin.close();???????
??}
??</script>
</head>
<body>
<form>
???<input?type="button"?value="新建窗口"?onclick="openWindow()"?/>
???<input?type="button"?value="關(guān)閉窗口"?onclick="closeWindow()"?/>
</form>
</body>
</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~

<input type="button" value="新建窗口" onclick="closeWindow()" />應(yīng)該是openWindow();

關(guān)閉窗口:window.close();

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

a746785570

我在想,第一個函數(shù)聲明的變量,第二個函數(shù)能直接使用?
2015-03-02 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

我寫了兩個函數(shù),一個打開窗口,一個關(guān)閉窗口,為什么不起作用呢?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號