zoukankan      html  css  js  c++  java
  • JavaScript: The Definitive Guide, 6th Edition Chapter 1 Note 1 Kevin

    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.

  • 相关阅读:
    奶酪真香
    规格说明书
    33
    111
    出题
    随笔 01
    我爱奶酪
    用户规格说明书
    第二次结对作业
    结对作业1
  • 原文地址:https://www.cnblogs.com/kfx2007/p/2642729.html
Copyright © 2011-2022 走看看