Wt slip tybcs11to 20
@Slip-11 Q. 1) Write a Javascript program to accept name of student, change font color to red, font size to 18 if Student name is present otherwise on clicking on empty text box display image which changes its size (Use onblur, onload, onmousehover, onmouseclick, onmouseup) Ans: <!DOCTYPE html> <html> <head> <title>JavaScript Example</title> <style> #name { Font-size: 14px; Color: black; } </style> </head> <body> <input type=”text” id=”name” onblur=”changeStyle()” onmouseover=”changeSize()” onmouseout=”resetSize()” onmousedown=”changeColor()” onmouseup=”resetColor()”> <img id=”img” src=https://via.placeholder.com/150 onload=”changeImageSize()”> <script> Function changeStyle() { Let name = document.getElementById(“name”).value; If (name) { Document.getElementById(“name”).style.fontSize = “18px”; Document.getElementById(“name”).style.color = “red...
Comments
Post a Comment