Blackbing Playground
Blackbing Playground

記錄一些生活與工作的雜事,偶爾會寫一些前端網頁開發的心得


  • 首頁

  • 歸檔
Blackbing Playground

Javascript in IE Mobile 6.0

發表於 2009-05-22

  1. Is Ajax support on Internet Explorer Mobile?

    Actually, IE Mobile’s Ajax support dates back to Windows Mobile 2003.

  2. javascript & AJAX 實做心得

    1. 可用AJAX,但desktop IE的javascript Framework有很多function不適用,因此建議還是依需求開發。

      1. 針對AJAX部份我有根據官方範例寫了一個Ajax call function for Mobile IE

        http://blackbing.net/lab/mobile/mobileAjax.js


    2. 基本的javascript幾乎都支援,getElementById, setTimeout, etc..

    3. 只有button 有onclick事件,其他如DIV、SPAN上沒有這種event。

    4. 請注意IE Mobile 沒有「onMouseOver」事件。

    5. CSS支援度差,不支援定位(position, top, left),且javascript存取css的方式也有限,必須反覆測試style的表現。

    6. On Smartphone/PocketPC 2003 innerText and innerHTML Properties are only supported on div and span elements.

      On Windows Mobile 5 innerText and innerHTML Properties are supported on all elements.


  3. 開發AJAX應用程式的注意事項:

    1. 使用者介面越簡單越好

    2. 資料傳輸量越精簡越好(JSON)

    3. DOM tree 越淺(shallow)越好

    4. 若有大量資料要隱藏,請避免使用display:none,直接採用DOM操作方式remove掉。(保持頁面資料越精簡越好)

    5. 盡可能不要讓使用者輸入data,改由select方式

    6. Adding On-Demand Script


  4. 其他:

    1. how to configure Internet Explorer Mobile to display script errors?

      To configure IE Mobile to display script error messages requires you to create a new registry entry.

      1. Open the device/emulator registry using the Remote Registry Editor or other Windows Mobile registry tool

      2. Navigate to the registry key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

      3. Create a new DWORD entry for the key; name the new entry ShowScriptErrors and set the value to 1

      4. Soft-reset the device/emulator

        Once you complete these steps, IE Mobile will display error messages for any script errors that occur.



    2. Enabling Cross-Domain Calls in Your Development Environment

      When working in your development environment, you can disable the security check that prevents the XMLHTTP object from making a cross-domain call. You do this by modifying the value of the appropriate registry entry using the following steps.

      1. Open the device/emulator registry using the Remote Registry Editor or other Windows Mobile registry tool

      2. Navigate to the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Internet Settings\Zones\3

      3. Change the value of the entry named 1406 to 0.

      4. Soft-reset the device/emulator

        Once you complete these steps, the XMLHTTP object can call into any domain without restriction.




  1. 參考資料:

    1. Mobile Web Development

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_mobilewebdev.asp

    2. Mobile DOM Reference Guide

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mogrfdomreferenceguide.asp

    3. Mobile CSS Support

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mogrfdomreferenceguide.asp?frame=true

    4. Windows Mobile Developers Wiki

      http://channel9.msdn.com/wiki/default.aspx/MobileDeveloper.HomePage


Blackbing Playground

Flash 移動特效

發表於 2009-05-05

昨天有朋友問我會不會寫移動的特效,他需要複製多個MovieClip,而可以針對這些MovieClip做任意排列、例如排成直線、圓形、矩形等。聽起來有點複雜,不過分析了一下其實只有簡單的兩個問題:

  • 決定物件的target位置,並將物件從A點移動到target位置。
  • 排列多個物件,使其依照各種形狀排列。

因此只要決定好物件的target位置,就只要將任一物件從A點移動到B點即可。蠻有趣的,我就動手coding啦~當然,點A移動到點B很簡單,所以我又加上了easing的效果,讓移動的特效看起來比較順暢。接下來就是決定各種形狀的排列,排成直線、圓形、矩形、任意排列。當然別忘了「隨機」也是個很重要的重點。

最後又有一個難題:在眾多物件中挑出一類來排列,原本的想法只要將其他物件隱藏即可,但這樣看起來就不自然,所以我將其他物件的target隨機設在範圍外,這樣就像飛出去的效果了。最後的完成品如下。
https://dl.dropboxusercontent.com/u/751847/blog/uploads/2009/05/randershape_demo.swf

當然,我做的很醜XD。想要研究原始碼的再留言給我。 :-D

Blackbing Playground

取得目前的Time stamp,以及「+」運算符的特性

發表於 2009-05-01

一般來說,我們都會用

1
new Date().getTime()

來取得目前的time stamp,今天在cssRain看到JavaScript—new Date().getTime()的简写方式,發現

1
+new Date()

這兩個會出現相同的結果,這讓我不禁好奇了「+」這個運算符他的特殊用法,
測試了幾個結果:

閱讀全文 »
Blackbing Playground

取得script的Root路徑

發表於 2009-05-01

做專案時常常因為路徑問題而困擾,因為現在用的路徑很可能到另一個環境就有大幅度的變動,寫前端程式的時候更常遇到這個問題,當然每個人都會把路徑獨立出來成一個變數,到時候若要改的話只要改個變數即可,但像CSS的url command就可以讀相對路徑,因此路徑只要指向相對路徑即可,就算環境換了也不用改任何程式。因此如果每一隻script都可以知道自己被include的Root路徑,需要指定路徑的地方就只要根據這個Root路徑來做相對路徑即可。例如一隻js檔裡頭需要動態產生圖片,那麼就會需要用到這個相對路徑。

閱讀全文 »
Blackbing Playground

UrMap 地圖一指通 DEMO

發表於 2009-04-18

當你在瀏覽部落格食記時,看到有興趣的店家地址,有時後會希望能夠直接看到該地址的地圖,這時候若blog沒有提供地圖連結時,就必須要複製地址再丟到地圖網站或google查詢,你可以將UrMap 地圖一指通的語法嵌入到你的blog中,讓閱讀你blog的讀者看到地址時點選一下就會在地址之後產生一個小地圖icon。


例如:點選右邊的「地圖一指通」


台北縣板橋市文化路一段240號

Blackbing Playground

線上排版工具

發表於 2009-03-23

  • 程式碼排版(支援多種程式碼)

    • http://www.prettyprinter.de/



  • javascript排版

    • http://jsbeautifier.org/



  • JSON排版產生樹狀結構,亦可轉成xml,另有AIR版本可下載

    • http://jsoneditor.net/



Blackbing Playground

(偽)IE8加速器

發表於 2009-03-18

IE8多了一個Accelerator(加速器)的功能,立意良好,使用起來也蠻直覺方便的,不過其他瀏覽器要這種功能的話就還要裝外掛或者是另外開發,但若直接透過javascript是否能做到類似的功能呢?答案是肯定的,而且作法不難…

閱讀全文 »
Blackbing Playground

safari4 bug?

發表於 2009-03-08

事情是這樣的,safari4隆重推出之時,號稱是世界上最快的javascript engine:松鼠魚,我就很開心的給他下載下來玩玩看,結果,原本在safari2, 3都正常的頁面,竟然在safari4掛掉了,OK,這可是個大問題,於是我開始想辦法debug。頭一個就遇到問題,我想辦法要打開safari4的debug mode,但是怎樣試都找不到,雖然後來google 有找到windows版本的方式:Enable Debug Mode in Safari4,終於讓develop menu出現了,但是….裡頭的選項我怎麼點都沒用!!

閱讀全文 »
Blackbing Playground

MySQL Workbench(mySQL 資料關聯圖)

發表於 2009-02-22

找了一下繪製mySQL資料關聯圖的工具,這套還蠻好用的,而且是官方的產品。可以dump sql出來產生design diagram,也可以藉由design來產生sql,相當方便。

MySQL Workbench is a next-generation visual database design application that can be used to efficiently design, manage and document database schemata.

資料來源:MySQL Workbench

Blackbing Playground

動態載入Javascript

發表於 2009-01-15

jQuery中動態載入Javascript的方式寫得很不錯,修改了一下把他拿出來用。但若要動態載入CSS就沒辦法使用onload的callback,可能還是要使用setInterval來檢查是否load到頁面上。

閱讀全文 »
1…891011
Bingo Yang

Bingo Yang

記錄一些生活與工作的雜事,偶爾會寫一些前端網頁開發的心得

109 文章
61 分類
RSS
© 2018 Bingo Yang
由 Hexo 強力驅動
主題 - NexT.Muse