注冊時選擇閱讀條款
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>demo2.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var $submitBtn=$("#submitBtn");//獲取按鈕對象
//為按鈕注冊點擊事件
$submitBtn.click(function(){
//alert("我被點擊了!");
});
//第二種 綁定事件 第一個參數是綁定事件的類型,第二個參數是觸發的函數
$(submitBtn).bind("click",function(){
var $check=$("#agree");//獲取checkbook的元素對象
//把jQuery轉換成Dom對象
/*var checkDom=$check[0];
if(checkDom.checked){
alert("同意注冊!");
}else{
alert("請選擇同意條款!");
}*/
if($check.is(":checked")){
alert("同意注冊!");
}else{
alert("請選擇同意條款!");
}
});
});
</script>
</head>
<body>
注冊條款:<input type="checkbox" id="agree"/>我已仔細閱讀並接受csdn注冊條款。
<input type="submit" value="注冊" id="submitBtn"/>
</body>
</html>
左右移動 ------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>demo03.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var $romve=$("#romve");
var $romves=$("#romves");
$romve.click(function(){
var $opts=$("#ropt>option:selected");
$opts.appendTo("#lopt");
});
$romves.bind("click",function(){
var $opts=$("#ropt>option");
alert($opts.length);
$opts.appendTo("#lopt");
});
//雙擊
$("#ropt").bind("dblclick",function(){
var $pots=$("#ropt>option:checked");
$pots.appendTo("#lopt");
});
});
$(document).ready(function(){
var $lromve=$("#lromve");
var $lromves=$("#lromves");
//注冊click事件
$lromve.click(function(){
var $opts=$("#lopt>option:selected");
$opts.appendTo("#ropt");
});
//綁定事件
$lromves.bind("click",function(){
var $opts=$("#lopt>option");//獲取所有的option
//alert($opts.length);
$opts.appendTo("#ropt");
//$("#ropt").append($opts);
});
//雙擊
$("#lopt").bind("dblclick",function(){
var $opts=$("#lopt>option:checked");//獲取所有的option
$opts.appendTo("#ropt");
});
});
</script>
</head>
<body>
<h1 align="center">左右漂移</h1>
<div style="position: absolute; left: 450px; top: 120px">
<div style="float:left; width: 200px; height: 300px; background-color:lightsteelblue; text-align: center;"><br><br>
<select id="lopt" multiple="multiple" size="9" style="width: 80px;">
<option>aa</option>
<option>bb</option>
<option>cc</option>
<option>dd</option>
<option>ee</option>
<option>ff</option>
<option>gg</option>
<option>hh</option>
<option>pp</option>
</select>
<br/><br/>
<input type="button" id="lromve" value="選中的右移" style="width: 80px;"/><br/><br/>
<input type="button" id="lromves" value="全部右移" style="width: 80px;"/>
</div>
<div style ="width: 200px; height: 300px; background-color: #bbffaa; text-align: center;"><br><br>
<select id="ropt" multiple="multiple" size="9" style="width: 80px;">
<option>選項1</option>
<option>選項2</option>
<option>選項3</option>
<option>選項4</option>
<option>選項5</option>
<option>選項6</option>
<option>選項7</option>
<option>選項8</option>
<option>選項9</option>
</select>
<br/><br/>
<input type="button" id="romve" value="選中的左移" style="width: 80px;"/><br/><br/>
<input type="button" id="romves" value="全部左移" style="width: 80px;"/>
</div>
</div>
</body>
</html>