-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.html
More file actions
35 lines (34 loc) · 1.13 KB
/
jquery.html
File metadata and controls
35 lines (34 loc) · 1.13 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- todo: 引用 jquery npm cdn
1. 有一個 按鈕 id = btnid , class = btnclass
2. 有一個input id = inputtext , type = text
3. 當按鈕被點擊時 , input 的值會被改成 "Hello World"
-->
</head>
<body>
<button id="btnid">Click ID</button>
<button class="btnclass">Click CLASS</button>
<button id="XSS">Click XSS</button>
<div id="xssresult"></div>
<input id="inputtext" type="text">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
$("#btnid").click(function() {
$("#inputtext").val("Hello World By ID");
});
$(".btnclass").click(function() {
$("#inputtext").val("Hello World By CLASS");
});
$("#XSS").click(function() {
$("#xssresult").html("<script>alert(document.cookie);<\/script>");
});
});
</script>
</body>
</html>