巷尾的酒吧

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  64 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charsetUTF-8">
<title>Jquery Test</title>
<style type="text/css">
.class1 {left: 0px;top: 0px;height: 180px;width: 240px;display: block;background-color: blue;color: black;}
.class2 {left: 0px;top: 300px;height: 100px;width: 240px;display: none;background-color: blue;color: black;}
.spans {left: 0px;top: 300px;height: 100px;width: 240px;display: none;background-color: blue;color: black;}
</style>
</head>
<script type="text/javascript" src="../js/jquery/jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function(){
$("#buttonId").click(function(){
var userName=$("input[name='userName']").val();
var passWord=$("input[name='passWord']").val();
if(userName=='abin'&&passWord=='lee'){
$("#div1").hide();
$("#div2").show();
$("#spanId").show();
$("#spanId").html('userName='+userName+",passWord="+passWord);
}else{
$("#div1").toggle();
$("#div2").toggle();
$("#spanId").show();
$("#spanId").html('userName='+userName);
}
});
});
</script>
<body>
<div id="div1" class="class1">
UserName:<br/>
<input id="userId" name="userName" type="text"/><br/>
PassWord:<br/>
<input id="passId" name="passWord" type="text"/><br/>
<input id="buttonId" name="buttonName" type="button" value="猛击我"/>
</div>
<div id="div2" class="class2">
<span id="spanId" class="spans"></span>
</div>
</body>
</html>
posted on 2013-08-29 23:45 abing 阅读(230) 评论(0)  编辑  收藏 所属分类: jquery

只有注册用户登录后才能发表评论。


网站导航: