首页 > 其他 > 详细

输出内容(document.write)

时间:2016-05-05 15:58:03      阅读:226      评论:0      收藏:0      [点我收藏+]

document.write() 直接在页面中输出内容

第一种 直接输出

   document.write("I Love Javascript !") //输出内容为:I Love Javascript !

第二种 通过变量输出

   var mystr = "hallo world!";

   document.write(mystr); //输出结果为:hallo world!

第三种 输出多项内容,内容之间用+号链接

    var mystr = "hello";

    document.write(mystr+"I Love Javascript"); //输出内容为:hello I Love Javacsript

第四种 输出HTML标签,标签使用""括起来

   var mystr = "hello";

   document.write(mystr+"<br>");  //输出的内容会换行

   document.write("javascript");  

 

输出内容(document.write)

原文:http://www.cnblogs.com/2520IT/p/5462181.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!