click below
click below
Normal Size Small Size show me how
JAVASCRIPT WEEK 3
Question | Answer |
---|---|
prompt("Hello"); | Display a prompt box |
alert("Hello"); | Display alert message |
open(" | Open the specific website in a new tab |
function closeFunction(){ close();} <input type="button" value="Close" onclick="closeFunction()"/> If you press the 'Close button' | The website will close |
confirm("Hello"); | Display a confirmation text with OK and CANCEL button |
screen.width | Get your screen's width |
var totalparagraph=document.getElementsByTagName("p"); alert("The total paragraphs are: "+totalparagraph.length); | Count the paragraphs |
if document.passwordvalid.password.value.length>10{ document.write("Valid Password"); } | If the password's length is greater than 10, then the code will display the message "Valid Password". |
what does the code below check? if (isNaN(number)) {} | If the variable 'number' is not a number |
var grade=document.getElementById("number").value; | Get and returns an element with id 'number' |