Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>JavaScript</title>
- </head>
- <body>
- <script>
- function changeTextB() {
- var x = document.getElementById("demo");
- x.style.color = "blue";
- }
- function changeTextR() {
- var x = document.getElementById("demo");
- x.style.color = "red";
- }
- function changeTextBL() {
- var x = document.getElementById("demo");
- x.style.color = "black";
- }
- function numberTest() {
- var x, text;
- x = document.getElementById("numb").value;
- if (isNaN(x) || x < 1 || x > 10 || x == 5 ) {
- text = "Incorrect";
- } else {
- text = "Correct";
- }
- document.getElementById("Output").innerHTML = text;
- }
- </script>
- <p id="1"> Before The Test. </p>
- <button type ="Button"
- onclick="document.getElementById('1').innerHTML = ' After The Test. ' ">
- Click to test! </button>
- <button type="Button"
- onclick="document.getElementById('1').innerHTML = ' Before The Test. ' ">
- Reset! </button>
- </br><br>-----------------------------------------------------</br>
- <p id="demo"> Colour. </p>
- <button type ="button" onclick="changeTextB()"> Blue! </button> <button type="button" onclick="changeTextR()"> Red! </button><button type="button" onclick="changeTextBL()"> Black! </button>
- </br></br>-----------------------------------------------------</br></br>
- Input a number between 1 and 10, except 5.
- </br>
- <input id="numb" type="number">
- <button type="button" onclick="numberTest()">Submit</button>
- </br>
- <p id="Output"></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement