課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
如果想打開的是一個(gè)div,是不是也用window.open,具體怎么用?
2016-04-20
源自:JavaScript入門篇 2-5
正在回答
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? ?<script type="text/javascript" language="javascript">
function ShowDiv(obj){
document.getElementById(obj).style.display = 'block';
}
</script>
<input type="button" value="對(duì)話框" onclick="ShowDiv('test')"/>
<div id="test" style="display:none;position:absolute;left:10%;top:10%;width:80%;height:200px;background-color:#F00">
?</div>
?</head>?
?<body>?
? ?</body>
</html>
自己拷貝運(yùn)行去看,上面的樣式自己可以隨便改。
慕粉3229093 提問者
window.open是打開一個(gè)新窗口,不能打開div.打開div可以利用css屬性設(shè)置或者javascript程序或者jquery程序
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
2 回答用Window.open()打開網(wǎng)址
1 回答var定義的 b 是不能在window.open中使用的嗎 如果能怎么實(shí)現(xiàn)
2 回答window.open("http://idcbgp.cn");是打開一個(gè)網(wǎng)頁(yè)的意思嗎?
1 回答toolbar和menubar的具體用法是怎樣的?
5 回答在第二個(gè)if條件中的 var new=window.open這里 ,打不開網(wǎng)站,但是不賦值只用window.open(' ','',''); 卻可以打開網(wǎng)站了,這是為什么?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-04-20
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? ?<script type="text/javascript" language="javascript">
function ShowDiv(obj){
document.getElementById(obj).style.display = 'block';
}
</script>
<input type="button" value="對(duì)話框" onclick="ShowDiv('test')"/>
<div id="test" style="display:none;position:absolute;left:10%;top:10%;width:80%;height:200px;background-color:#F00">
?</div>
?</head>?
?<body>?
? ?</body>
</html>
自己拷貝運(yùn)行去看,上面的樣式自己可以隨便改。
2016-04-20
window.open是打開一個(gè)新窗口,不能打開div.打開div可以利用css屬性設(shè)置或者javascript程序或者jquery程序