|
Answer» You can change font and text of an element by using a FUNCTION. Example: <html> <head> <script type="text/javascript"> function ChangeText() { document.getElementById("welcome").style.color="red"; document.getElementById("welcome").style.fontFamily="Times New Roman"; document.getElementById("welcome").style.fontSize="20"; } </script> </head> <body> <p ID="welcome">R4R Welcomes You!</p> <INPUT type="button" onclick="ChangeText()" value="When you click on button text font and color will change"> </body> </html> You can change font and text of an element by using a function. Example: <html> <head> <script type="text/javascript"> function ChangeText() { document.getElementById("welcome").style.color="red"; document.getElementById("welcome").style.fontFamily="Times New Roman"; document.getElementById("welcome").style.fontSize="20"; } </script> </head> <body> <p id="welcome">R4R Welcomes You!</p> <input type="button" onclick="ChangeText()" value="When you click on button text font and color will change"> </body> </html>
|