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

Mark java script & jquery 基本入門

  • 211 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
211
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. JavaScript & jQuery 基本入門 MARK CHEN 2014/1/19 1
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 使用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