[HTML] Bói thầy phán
Sun May 20, 2018 4:43 pm
- Code:
<html>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
</head>
<body style="word-wrap: break-word;">
<div class="container">
<input class="form-control" id="txtInput" type="text">
<button type="button" class="btn btn-success" id="btnClick" onclick="myFunction()">Thầy Phán</button>
</div>
</body>
<script>
function myFunction() {
var input = document.getElementById("txtInput").value;
if (input.indexOf("ăn") >= 0) {
alert("Ăn gì hông được");
} else if (input.indexOf("uống") >= 0) {
alert("Kênh Nhiêu Lộc nhiều nước lắm");
} else if (input.indexOf("đi") >= 0) {
alert("Cầu Sài Gòn thẳng tiến");
} else {
var x = Math.floor((Math.random() * 10) + 1);
if (x == 1 || x == 6) {
alert("Hỏi khó vậy ba");
}
else if (x == 2 || x == 7) {
alert("Chơi nhau à");
}
else if (x == 3 || x == {
alert("Hỏi hỏi cc");
}
else if (x == 4 || x == 9) {
alert("Cù Trọng Xoay còn thua");
}
else if (x == 5 || x == 10) {
alert("Mầy định thử thầy à");
}
}
}
</script>
</html>
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|