DOM:document.getElementById========================================================================= <html> <head> <title>getElementById example</title> <script type="text/javascript"> function changeColor(newColor) { elem = document.getElementById("para1"); elem.style.color = newColor; } </script> </head> <body> <p id="para1">Some text here</p> <button onclick="changeColor('blue');">blue</button> <button onclick="changeColor('red');">red</button> </body> </html> ==========================================================
|