给出一个javascript的Helloworld例子


1.基础知识:

1)Helloworld:

例 1.1


<html>
<head>
    <!--  马克-to-win:如果你用notepad建立一个txt之后你再改为html,一定在存时,要存成utf-8或unicode格式,或者你也可以用 myeclipse html designer,这样你看的文本是有颜色的,如果觉得字体小,可以在myeclipse html designer下面的窗口里右击鼠标,/preferences/general/editor/text editor.注意在texteditor窗口里面的右边最下面,有一行不起眼你的小字,color and font,你可以设置。-->
</head>
<script type="text/javascript">
    var a ;
    /*before you set value, a' type can not be defined.*/
    document.writeln(typeof(a) + "<br>他们");
    a = true;
    document.writeln(typeof(a) + "<br>");
    /*下面的console.log只有安装了firebug的firebox不报错*/
    console.log("This is the 1 message 马克-to-win write in %s", a);
    document.writeln(a);
</script>我们

输出结果:
undefined
他们 boolean
true 我们

详见:http://www.mark-to-win.com/index.html?content=Javascript/jsUrl.html&chapter=Javascript/js1_web.html#HelloWorld

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/82805782