這裏是我的代碼的JavaScript如果CSS高度Else語句
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="js/jquery-1.7.2.min.js"></script>
<style>
div{
border:2px solid black;
width:200px;
min-height:300px;
}
</style>
</head>
<body>
<div>
<p id="demo">This will change</p>
<input type="button" value="OK" onclick="myFunction()"/>
</div>
<script>
$(document).ready(function()
{
$("input").click(function()
{
if($("div").height("300px") === true){
document.getElementById("demo").innerHTML="HELLO WORLD!";
}
});
});
</script>
</body>
</html>
我想做的事情是這樣的,如果DIV高度等於300像素的「這將改變」段將變爲您好世界上點擊一個按鈕。對不起,這是我第一次訪問javascript
非常感謝你..只是我想要的方式。 =) – 2012-08-16 19:06:54