Mark   java script & jquery 基本入門
Upcoming SlideShare
Loading in...5
×
 

Mark java script & jquery 基本入門

on

  • 359 views

 

Statistics

Views

Total Views
359
Views on SlideShare
359
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Mark   java script & jquery 基本入門 Mark java script & jquery 基本入門 Presentation Transcript

  • JavaScript & jQuery 基本入門 MARK CHEN 2014/1/19 1
  • JavaScript – Types of Data 內建三種基本資料型態(primitive data type) 數值(number) NaN不等於任何值,NaN也不等於NaN 字串(string) 布林值(boolean) 複合資料型態(composite data type) 物件(object) 特殊的值 null → var x = null;  null表示沒有任何東西 undefined → var x; 或 void x;  當試圖去取得某個沒指定任何值、或null、或properties的變數時,就會出現undefined的結果 2014/1/19 2
  • Object 建立Object: var obj = new Object(); 或使用物件實字(Object literal)的方式 建立: var obj = {}; 也可為Object直接設定properties: var person = { name: „Mark‟, age: 30 }; 2014/1/19 只要簡單指定就可以幫Object直接 加上新的properties或是function obj.x = 10; obj.y = „This is string!‟; 存取properties的表示法 obj.x; > 10 obj[„x‟]; > 10 3
  • Function function是物件,是Function的實例 也因為是Function的實例,所以可以將function傳給另 一個變數參考 var max = new Function('num1', 'num2', 'return num1 > num2 ? num1 : num2'); 或 function max(num1, num2) { return num1 > num2 ? num1 : num2; } var maximum = max; 2014/1/19 4
  • 使用jQuery <script src=“js/jquery-1.8.3-min.js”></script> <script> $(document).ready(function(){ //Code is write here )}; </script> $(document).ready()的作用就是等網頁全部都 載入完成之後,才開始執行Javascript 使用jQuery從$()開始 $(„#menu‟).hover( function(){ $(„#submenu‟).show();  簡潔寫法: <script src=“js/jquery-1.8.3-min.js”></script> <script> $(function(){ //Code is write here )}; </script> 2014/1/19 }, function(){ $(„#submenu‟).hide(); } ); 5