-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexjQueryEvent.html
87 lines (75 loc) · 2.46 KB
/
indexjQueryEvent.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html> <!-- html5 的標籤標準規定 -->
<html>
<head>
<title>test boostrap</title>
<meta charset="UTF-8"> <!-- 需要加入讓WEB知道有中文編碼 -->
<meta name="viewport" content="width=device-width, initital-scale=1.0"> <!--網頁如要以手機為主,需加入viewport設置-->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="js/bootstrap.min.js"></script>
<script src="js/jquery.min.js"></script> <!--需要去jquery網站載jquery lib放入網頁資料夾OR利用利用CDN方式讓連網後自動去抓-->
<script>
$(document).ready(function(){ //在整個網頁讀取完畢後,執行後面的function()
$("input").focus(function(){
//利用jquery的功能$ 去選取input element,只要哪個input element 有觸發focus event,即執行後面的function()
$(this).css("background-color","#f00"); //被選到的dom中的element,執行CSS()
});
});
function myfun2()
{
}
function myfun3()
{
}
</script>
</head>
<body>
<div class="row">
<div class="col-lg-4 col-4"><h1>Hello</h1></div>
<div class="col-lg-4 col-4"><h2>world</h2></div>
<div class="col-lg-4 col-4"><h2>Ben</h2></div>
</div>
<div class="row">
<div class="col-lg-4">
<button class="btn btn-default" onclick="myfun()">
click A
</button>
</div>
<div class="col-lg-4">
<button class="btn" onclick="myfun2()">
<span class="glyphicon glyphicon-asterisk"></span>
click B
</button>
</div>
<div class="col-lg-4">
<button onclick="myfun3()">click C</button>
<button onclick="myfun4()">click D</button>
</div>
</div>
<div class="row">
<div class="col-lg-3"><h1>廣告資訊</h1></div>
<div class="col-lg-9">
<h2><span class="glyphicon glyphicon-star"></span>
我的文章
</h2>
<p id="demo">而另外像Tokai、集山也都需要再協助處理,昨日才又處理與了解集山問題,此部分都需考量。</p>
</div>
</div>
<div class="row">
<div class="col-lg-3"><h1>DOMtest</h1></div>
<div class="col-lg-9">
<h2><span class="glyphicon glyphicon-star"></span>
DOMTest for jquery
</h2>
<div id ="div1">
your name: <input></input>
<h3 id = "demo2">this is info.</h3>
<p id = "p1">this is paragraph1.</p>
<p id = "p2">Hello Ben</p>
<p>Good</p>
<p class="help-block">this p has class.</p>
<button onclick="myfun2()">push me</button>
</div>
</div>
</div>
</body>
</html>