[ js ] 改變div的大小
我希望可以按下div後,div會慢慢的變長
然後還做了一個button,按下後,div會直接回復成原來的樣子
可是一直無法成功
以下是網頁的程式碼
<script language="JavaScript">
<!--
function big1(){
var sizeheight = 100;
for (sizeheight <200; sizeheight += 5;){
return document.getElementById('area1').style.height=sizeheight;
}
}
-->
</script>
<html>
<head>
<title>未命名頁面</title>
<style type="text/css">
.style2 {
border-style: solid;
border-color: black;
background-color: blue;
width: 100px;
height:100px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id=area1 hidefocus="hidefocus" class=style2 onclick=big1()>
</div>
<asp:Button ID="Button1" runat="server" Text="Button"
OnClientClick="document.getElementById(area1).style.height='100';"/>
</form>
</body>
</html>
網頁執行之後,按div,div只會變長5px
不知道程式那裡出了問題?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.192.211
→
07/24 17:02, , 1F
07/24 17:02, 1F
→
07/24 17:10, , 2F
07/24 17:10, 2F
→
07/24 17:31, , 3F
07/24 17:31, 3F
→
07/24 17:32, , 4F
07/24 17:32, 4F
→
07/24 17:33, , 5F
07/24 17:33, 5F
→
07/24 17:33, , 6F
07/24 17:33, 6F
推
07/24 17:33, , 7F
07/24 17:33, 7F
→
07/24 17:36, , 8F
07/24 17:36, 8F
→
07/24 17:57, , 9F
07/24 17:57, 9F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章
79
307