BananaMaster

26.5 - switch, case, default, if, else if, else, oninput ( JS lessons )

If you forgot something — click to go to the lesson.

Task 1.

Create an input type="text", a button, and a div. If "1234" is entered — display "ok", otherwise "error".

Task 2.

Create a select with options "small", "medium", "large", a button, and a div. On click, change the width of the div: 100px, 200px, 300px.

Task 3.

Create an input type="text", a button, and a div. If "admin" or "boss" is entered — display "Yes", otherwise "No".

Task 4.

Create an input type="number", a button, and a div. If the number is less than 0 or greater than 100 — display "error", otherwise "ok".

Task 5.

Create a select with options "red", "green", "blue", a button, and a div. On button click, change the text color of the div based on the selected value.

Text

Task 6.

Create two input type="number" and a button. On click, display the larger number.

Task 7.

Create a select with options "px", "em", "%", an input type="number", a button, and a div. On click, change the size of the box: the input defines the value, and the select defines the unit. (width and height)