|
Answer» We changed the text of an element by using an function. In this example text has been changed when you EXECUTE function. Example: <HTML> <HEAD> <script type="text/javascript"> function ChangeText() { document.getElementById("welcome").innerHTML="R4R Welcomes You!"; } </script> </head> <body> <p id="welcome">Hello User!</p> <INPUT type="button" onclick="ChangeText()" value="When you CLICK on button text will changed"> </body> </html> We changed the text of an element by using an function. In this example text has been changed when you execute function. Example: <html> <head> <script type="text/javascript"> function ChangeText() { document.getElementById("welcome").innerHTML="R4R Welcomes You!"; } </script> </head> <body> <p id="welcome">Hello User!</p> <input type="button" onclick="ChangeText()" value="When you click on button text will changed"> </body> </html>
|