1.document.body.innerHTML = "nnnn";2.document.write("nnn");1为什么实现不了啊 菜鸟求教
1 回答
已采纳
Y_du
TA贡献43条经验 获得超5个赞
<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function writeDiv(){ document.getElementById('body').innerHTML="div的内容为nnn"; } function writeSpan(){ document.getElementById('span').innerHTML="span的内容为nns"; } </script> </head> <body> <div id="body"></div> <div id="span"></div> <input type="button" value="修改div的值" onclick="writeDiv()"> <input type="button" value="修改span的值" onclick="writeSpan()"> </body> </html>
添加回答
举报
0/150
提交
取消