Linux 拨号vps windows公众号手机端

javascript输出语句有哪些

lewis 6年前 (2019-03-26) 阅读数 8 #程序编程
文章标签 JavaScript

javascript中的输出语句有:1.alert语句,显示消息给用户;2.console.log语句,在浏览器控制台中打印输出信息;3.document.write语句,在网页中输出内容;



javascript中的输出语句有以下几种

1.alert语句

javascript中alert语句的作用是用于显示消息给用户,常用于创建一个消息警告框。

alert语句使用方法:

<script type="text/javascript">
alert("hello world!");
</script>

2.console.log语句

javascript中console.log语句的作用是在浏览器控制台中打印输出信息。

console.log语句使用方法:

<script type="text/javascript">
console.log("hello world!");
</script>

3.document.write语句

javascript中document.write语句的作用是在网页中输出内容,常用于向网页输出一段文字。

document.write语句使用方法:

<script type="text/javascript">
document.write("hello world!");
</script>


版权声明

本文仅代表作者观点,不代表米安网络立场。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门