Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script> function displayResult(){ document.getElementById("p1").style.color="#ff0000"; document.getElementById("p2").style.color="magenta"; } </script> </head> <body> <p id="p1">这是一个示例段落。</p> <p id="p2">这也是一个示例段落。</p> <br> <input type="button" onclick="displayResult()" value="修改文本颜色"> </body> </html>