发布新日志

  • 脚本语言(二)

    2008-10-30 17:15:07

    1)Javascrīpt的注释:

    “<!-- …… -->”和“//”都表示注释,前者是在不支持javascrīpt时隐藏,后者是在可补忽略的注释。这两各注释都必须在一行内使用。

    2)内置函数:document.write(),输出文本。

    3)字符串的可加性,如:document.write("A"+"  "+"B"); 则在IE中会显示“A  B”字符。

    4)<a href=" http://www.hao123.com " ōnMouseOver="window.status='已经将鼠标已经放在了该链接上,现已移开'">链接到hao123</a>

    5)语句:if-else if-else;

    <html>
    <head>
    <scrīpt language="Javascrīpt">
    var java = prompt("你喜欢JAVASCIRPT吗?","输入“Y”或者“N”");
    if (java== "Y"){alert("欢迎你,来吧,我们继续学习吧!");}
    else if(java=="N"){alert("它很有趣的,不学多可惜,唉 :(");}
    else if(java=="123"){alert("你输入的是123~…~");}
    else {alert("这里只能输入Y和N");}
    </scrīpt>
    </head>
    <body>
    </body>
    </html>

    Today is over now.

  • 其知然,知其所以然!

    2008-10-30 16:08:04

    为了知其然,知其所以然,为测试铺平道路,开始我的开发语言学习。

    从脚本语言Javascrīpt开始:

    一个实例:

    <html>
    <head>
    <scrīpt language="javascrīpt">
    var helloE="Hello,welcom to the JS";
    var helloC="你好";
    function helloworld(){
    alert(helloE);
    alert(helloC);
    }
    </scrīpt>
    </head>
    <body ōnload=helloworld()>
    </body>
    </html>

    javascrīpt是用标签<scrīpt language="javascrīpt">……</scrīpt>来嵌入的;关键字var是用来定义变量的;关键字function是用来定义函数的;内置函数alert(),是用来弹出信息的显示窗的;另外,变量大小写敏感;还有分号“;”千万不可少是用来分割语句的;事件onload(),当被加载时触发。

Open Toolbar