BananaMaster

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

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

Task 1.

Create a select with options "sun", "rain", "snow", a button, and a div. On button click, display the corresponding word: sun — "sunny", rain — "rainy", snow — "snowy".

Task 2.

Create an input type="number", a button, and a div. If the number is greater than 0 — display "positive", if less than 0 — "negative", if equal to 0 — "zero".

Task 3.

Create two input type="number", a button, and a div. On click, set the width and height of the div to the entered values.

Task 4.

Create an input type="number", a button. If the number is greater than 100 — set the button background to green, otherwise red.

Task 5.

Create an input type="text". If "yes" is entered — set the input background to green, otherwise white. (Should work in real time)

Task 6.

Create an input type="number", a button, and a div. If the number is greater than 0 and less than 10 — display "small number", otherwise "no".

Task 7.

Create two buttons and a div. On "+20" click increase the width of the block by 20px, on "-20" click decrease it by 20px. Minimum — 40px, maximum — 300px. (Initial size — 100px × 100px)