伊莉討論區
標題:
如何關閉視窗
[打印本頁]
作者:
ipk230230
時間:
2019-12-28 09:10 AM
標題:
如何關閉視窗
本帖最後由 ipk230230 於 2019-12-28 09:18 AM 編輯
附上codepen
https://codepen.io/xunxas/pen/jOELyGe
https://codepen.io/Cangl0/pen/zYxzLwY
←這是原始的
想要在 紅圈的地方 做一個關閉的功能 java script 的程式碼怎麼寫
[attach]129994975[/attach]
作者:
tryit244178
時間:
2020-1-4 05:31 PM
本帖最後由 tryit244178 於 2020-1-4 05:57 PM 編輯
不難,把Div藏起來就行了。請參考下面
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<style>
div {
width: 100px;
background-color: lightblue;
border-radius: 10px;
padding: 150px;
}
</style>
<script>
function test()
{
document.getElementById("testDialog").style.display="none";
}
</script>
</head>
<body>
<div id="testDialog">
<button onclick="test()">點我!點我!</button>
</div>
</body>
</html>
複製代碼
你也可以把div元素整個消掉...
歡迎光臨 伊莉討論區 (http://10.eyny.com/)
Powered by Discuz!