开发环境:webstorm 6.0

基础铺垫:Web 2.0,XHTML和CSS

javacript的重要作用:

1. 基于web的应用程序的标准客户端脚本语言

2. 服务器端的脚本基础

 

程序调试前准备: 修改IE的Internet选项—安全-允许本地运行活动的内容

高级-浏览-显示脚本错误的提示

 

Netscape和Microsoft构建Javacript标准

 

ch4_1.html

<!DOCTYPE html>
<html>
<head>
    <title>First Program in Javascript</title>
    <script type = "text/javascript">
        <!--
                document.writeln("<h1>Welcome to Javascript Programming!</h1>");
        //-->
    </script>
</head>
<body>

</body>
</html>

 

<script type = "text/javascript">
        <!--
               被封装的代码
               如果浏览器支持,就执行;否则识别为注释
    
        //-->
    </script>

Javascirpt中的字符串可以封装在双引号或单引号中

每条语句添加分号隔开

对大小写敏感

 

ch4_2.xhtml

<!DOCTYPE html>
<html>
<head>
    <title>Pringting a Line with Multiple statements</title>
    <script type="text/javascript">
        <!--
        document.write("<h1 style = \"color: magenta\">");
        document.write("Welcome to Javascript " + "Programming!</h1>");
        //-->
    </script>
</head>
<body></body>
</html>

 

ch4_3.html

<!DOCTYPE html>
<html>
<head>
    <title>Pringting Multiple Lines</title>
    <script type="text/javascript">
        <!--
        document.writeln("<h1>Welcome to <br/> javascript<br/>" +
                "Programming</h1>");
        //-->
    </script>
</head>
<body></body>
</html>

 

ch4_4.html

<!DOCTYPE html>
<html>
<head>
    <title>Pringting Multiple Lines</title>
    <script type="text/javascript">
        <!--
        window.alert("Welcome to\nJavascript\nProgramming!");
        //-->
    </script>
</head>
<body>
<p>please refresh or reload this script again!</p>
</body>
</html>

 

ch4_5.html

<!DOCTYPE html>
<html>
<head>
    <title>Pringting Multiple Lines</title>
    <script type="text/javascript">
        <!--
        var name;

        name = window.prompt("Please enter your name");

        document.writeln("<h1>Hello, " + name + ", welcome to javascript programming!</h1>");
        //-->
    </script>
</head>
<body>
<p>please refresh or reload this script again!</p>
</body>
</html>

 

posted on 2017-12-23 00:03  cpycpp  阅读(166)  评论(0编辑  收藏  举报