<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>document.getElementById</title></head><body><p id="con">JavaScript</p><script type="text/javascript"> var mychar=document.getElementById("con"); document.write("结果:"+mychar); //输出获取的P标签。 </script></body></html> 我想让他的输出是: 结果:Javascript这种样式的话要怎么做
2 回答
已采纳
刚毅87
TA贡献345条经验 获得超309个赞
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>document.getElementById</title> </head> <body> <p id="con">JavaScript</p> <script type="text/javascript"> var mychar=document.getElementById("con").innerHTML; document.write("结果:"+mychar); //输出获取的P标签。 </script> </body> </html>
添加回答
举报
0/150
提交
取消