为了账号安全,请及时绑定邮箱和手机立即绑定

document.write("hello"); document.getElementById("p1").style.color="blue";

document.write("hello");

  document.getElementById("p1").style.color="blue";

 document.write ("hello")什么意思, 

  document.getElementById 什么意思呀  不懂 这怎么记?求解!


正在回答

5 回答

document.write("hello");//输出hello//

 document.getElementById("p1").style.color="blue";//将id为p1的元素的文本颜色设置为蓝色//

document.getElementById();是DOM中元素获取方法中的一种,通过元素的id名来获取元素

1 回复 有任何疑惑可以回复我~
#1

慕慕0677951 提问者

非常感谢!
2017-04-13 回复 有任何疑惑可以回复我~

document.write("");

是指输出双引号内的字符串

document.getElementById("p1").style.color="blue";

选取背景为p1的样式是指规定颜色为蓝色

0 回复 有任何疑惑可以回复我~

document.write("hello"); //输出hello

document.getElementById("p1") ,是指获取document对象

document.getElementById("p1").style.color="blue"; ,是指将所获取的document对象的样式颜色改为蓝色

0 回复 有任何疑惑可以回复我~

 document.write ("hello")是指在网页上打印出"hello"这个词;

 document.getElementById("p1").style.color="blue" 是指操作id为"p1"的样式,这里把id为"p1"的颜色样式修改成了蓝色

0 回复 有任何疑惑可以回复我~

JavaScript中输出hello

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

document.write("hello"); document.getElementById("p1").style.color="blue";

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号