i dont understand this code from javascript -
i dont understand this code from javascript -
i newbie javascript , wondering means in plain english.
<!doctype html> <html> <body> <p>please input number between 5 , 10:</p> <input id="demo" type="text"> <button type="button" onclick="myfunction()">test input</button> <p id="message"></p> <script> function myfunction() { *** var message, x; *** *** message = document.getelementbyid("message"); *** *** message.innerhtml = ""; *** x = document.getelementbyid("demo").value; seek { if(x == "") throw "is empty"; if(isnan(x)) throw "not number"; if(x > 10) throw "too high"; if(x < 5) throw "too low"; } catch(err) { message.innerhtml = "input " + err; } { document.getelementbyid("demo").value = ""; } } </script> </body> </html>
i don't understand part between ***'s. why tacking messaging , putting in messaging? please help , define programing words extremely knew person not understand.
than much.
var message, x;
declare 2 variables message
, x
undefined.
message = document.getelementbyid("message");
now assign dom node has id of "message" variable message
message.innerhtml = "";
we empty out might within dom container.
javascript
Comments
Post a Comment