1.2 Client-Side JavaScript:
confirm()函数:用于弹出确认对话框,setTimeout()函数用于,设置超时时间。
<script type="text/javascript"> function moveon() { var answer = confirm("Ready to move On?"); if(answer) { window.location = "Http://Google.com"; } }; setTimeout(moveon,6000); </script>
confirm 拼写错误将导致程序不能正常运行。
2.The Example demonstartes a number of core JavaScript language features, and also demonstares important client-side JavaScript techniques:
1.How to find elements in a document.
2.How to get user input from form input elements
3.How to set the HTML content of document elements.
4.How to store data in browser.
5.How to make scripted HTTP requests.
6.How to draw graphics with the <canvas> element.
If a line break appears after any of these words(before any other tokens),JavaScript will always interpret
that line break as a semicolon.For example,if you write:
Return true;
JavaScript assumes you meant:
return; true;
However,you probably meant:
return true;
What this means is that you must not insert a line break between retrun,break,or continue and the expression that follows the keyword.If you do insert a line break,your code is likely to failin a nonobvious way that is difficult to debug.