今、私はチャットボックスを作っています。これはあなたがあなたの名前を入力できるページのコードですが、ユーザーが私の名前(ウェブマスターの名前)を入力すると、ウェブマスターがいないため、ユーザーはエラーを受け取りました。私のif-else関数は機能しません。私を助けてくれる人はいますか?ありがとう
<html>
<head>
<title></title>
<style type="text/css">
#main{
width: 400px;
height: 300px;
background-color: #333;
text-align: center;
position: absolute;
color: white;
left:50%;
margin-left: -200px;
top: 50%;
margin-top: -150px;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function show() {
var text = document.getElementById('text');
if (text.value == "Jonathan Cazaerck"){alert("Deze gebruiker mag u niet gebruiken");}
else{
$.post("processing.php", { stage: "newuser", username: $("#text").val()}, function(data){
window.location = ("newsession.php?user="+data);}
);}
</script>
</head>
<body>
<div id="main"><br><br><br><br>
Geef je voor- en achternaam op: <br><br><input type="text" size="35" id="text"/><button id="send" onclick="show();">Verzenden</button>
</div>
</body>
</html>