Skip to content

Tag: 程式設計


Categories:

jQuery Plugin Weather

Post date:

測試上一版的 deferred object,搭配 worldweatheronline.com API。 $('#weather').weather({ key: 'API key', //worldweatheronline.com API Key query: 'kaohsiung,taipei', //英文城市名稱,使用半形逗號可列出多個位置 html: true/false, //是否輸出 html,預設 true unit: 'C/F', //溫度單位 C 攝氏, F 華氏,預設 'C' lang: 'en/tw', //語系 en 英文, tw 中文,預設 'tw' success: function (resp) {} //回傳氣象物件 }); Demo

我的常用 js 函式庫

Post date:

※ 2010-03-02 補充: Object prototype 改寫會導致 jQuery 出現異常,所以必須將 Object.prototype.isArray 註解或刪掉。 請參考:Prototyping Object in Javascript breaks jQuery? – StackOverflow 整理了一支我常用於網站開發的 js 函式庫,也包含了對字串、日期、陣列物件的 Prototype 增強函數,採 MIT 授權釋出,歡迎任意使用。 源碼:lib.common.js(16 KB) 壓縮:lib.common-min.js(9 KB) Prototype: String var url = 'http://essoduke.org/?s=測試'; var x = 'Test 測試'; var y = 'HTML'; var z = '&;lt;strong&;gt;HTML</strong>'; /* trim: 移除字串前後空白 */ x.trim(); // result: […]