HTML2-----点击gsgadg变色
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>童心少年</title> <style> p{ color:red } </style> </head> <body> <p style="color:blue">假设 y=5, 计算 x=y+2, 并显示结果 </p> <button onclick="myFunction()">点击这里</button> <p onclick="click1()" id="demo">gsgsdg</p> <script> function myFunction(){ var x=5; var y=x+1; x=y; var demoP = document.getElementById("demo") demoP.innerHTML="x="+x; } function click1(){ var demo=document.getElementById("demo") demo.style="color:blue"; } </script> </body> </html>
浙公网安备 33010602011771号