Answer the question
In order to leave comments, you need to log in
How to send your request for a site with socket io through the browser?
Hello there is one site there need to send a request for a site with a websocket .How to manually send a request? This is possible with normal post requests, but how to send with a websocket you need to know. There is such code in the code.
How to send it manually from the browser without any buttons.
send({
type: "chat",
user: utilizator,
message: sendInput
});
Answer the question
In order to leave comments, you need to log in
First, super is a reserved word.
Secondly, why did you decide that the code does not work, maybe just the variable is not equal to 1.
Thirdly, please show the context, it looks pretty funny when the alert "Exactly???" immediately flies out when the page is loaded. =)
//upd
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="JS/ScriptTest.js"></script>
<link rel="stylesheet" href="CSS/StyleTest.css">
<title>Document</title>
</head>
<body>
<input type="text" id="OP" onkeyup="if (this.value == 1) alert('Точно ?')">
</body>
</html>
1. Don't capitalize variables + Super(super) is a reserved word
2. What kind of tag do you store in Super
?
If it's not input
, then use textContent
. textContent
returns a string, so parse it (parseInt) before checking.
UPD:
var userText = document.getElementById('OP').value;
if(parseInt(userText) === 1){
alert("wooow")
};
<input type="text" id="OP" value="1">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question