还是跟着视频学的,乍一眼看还是跟C语言很像的,但是在细节方面又优化了很多C的复杂之处,总之是个很神奇的语言,也蛮有意思的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <html> <head> <meta charset = utf-8> </head> <body> <script> var hello = "HELLO"; document.write("Hello World!"); document.write(hello); function h() { document.write(hello); } h();
var marks = new Array(); marks[0] = 89; marks[1] = 78; marks[2] = 90;
var o = new Object(); o.name = "John"; o.age = 30; o.salary = 300; for(var x in o) { alert(x + "=" + o[x]); }
for( x in document) document.write(x + "<br>"); </script>
<p onmouseover="alert('Fuck');" onmouseout="alert('You');"> 一个段落 </p>
<script> if(confirm("还要继续吗?")) alert("OK"); else alert("Bye");
var name = prompt("Your name:"); </script>
</body> </html>
|