美文网首页
JAVAscript记录(一)

JAVAscript记录(一)

作者: 修卡录 | 来源:发表于2017-01-06 14:30 被阅读0次

<script type="text/javascript">

//写要在浏览器显示内容的代码。如

documengt.write("hello world")

</script>

对上浏览器会显示hello world.

加""与不加""的两种显示

一.document.write("")

显示的是双引号里的内容,就是说双引号里是什么,浏览器就显示什么除了一些标签显示其效果如document.write("<br>")那么就是效果——强制换行。

document.write("hello world")对于这两个单词之间的一个空格效果,浏览器会显示出来,但也仅仅一个,也就是说在那两个单词之间按n个空格,也只显示一个(限词间),如要多个,试试&nbsp。(限词间)

我所知的表达document.write("hello world")

docment.write("hello"+"world")

二.document.write()

<script type="text/javascript">

var name=8

document.write(name)

</script>

浏览器显示的是8,而不是name。若要显示name,则document.write(“name”)

这次结束,学习中,特记录,不知理解是否到位

相关文章

网友评论

      本文标题:JAVAscript记录(一)

      本文链接:https://www.haomeiwen.com/subject/nhatbttx.html