现在的位置: 首页 > 综合 > 正文

【JavaScript】Helloworld

2017年11月27日 ⁄ 综合 ⁄ 共 500字 ⁄ 字号 评论关闭

JavaScript无需布置任何环境

直接在HTML写代码就可以,使用任何文本编辑器的软件都可以用来开发JavaScript程序

以下是JavaScript最基本的Helloworld

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<script type="text/javascript">
<!--
document.write("a!");//向网页输出信息a
alert("hello,world!");//弹窗,对话框的内容是"hello,world!"
-->
</script>
</body>
</html>

网页运行结果图如下:

抱歉!评论已关闭.