<!DOCTYPE html>
<html>
<head>
<title>初识jQuery</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var i=false;
function sayHello(){
if(!i){
$("#test").show();
i=true;
$("#test").text("开启状态"+i);
}else{
$("#test").hide();
i=false;
}
}
</script>
</head>
<body>
<div id="test">Hello iMooc!</div>
<button onclick="sayHello()">点我!</button>
</body>
</html>
东安
2014-08-12
2 回答
举报
0/150
提交
取消