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>
网页运行结果图如下: