我的第一个js程序
写javascript 不需要编译,文本编辑器与一个web浏览器就够了。
编写的 javascript 程序必须通过html/xhtml文档才能执行。
本人学习js 看的是javascript dom编程艺术这本书,例子是这本书扒出来的。
建立以html格式结尾的文档 test.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>just a test</title>
</head>
<body>
<script src="my.js">
</script>
</body>
</html>
建立 my.js 文件 内容打印 helloworld,这有这一句。
document.write("HelloWorld");
用浏览器打开html文件,显示helloworld