preload
Mar 29


程式名稱為My fone


載入畫面


操作畫面.

請台灣大哥大的朋友幫忙到 http://liho.tw/fone/測試.
我認為應該有很多錯誤. 因為我不熟台灣大哥大的規則.
如果您知道有計算上的錯誤請您告訴我.謝謝.

有點小累, 先這樣.晚點再補齊.

Tagged with:
Mar 24

今天晚上臨時想寫個節費程式. 這樣就可以算到底還有多少通簡訊可以傳. 到底還有幾分鐘通話可以使用. 目前這隻程式還算很陽春. 最好是能夠直接登入emome然後把資料撈回來. Orz 就不用輸入那些有的沒有的通話及簡訊費用了.

畫面大概如下 :


程式名稱為My mPro


載入畫面


大家講使用畫面


元氣型使用畫面


基本型使用畫面

請用iPhone瀏覽 : http://liho.tw/mpro/ 頁面. 記得加入主畫面(Home Screen).
在使用這個節費程式前, 先到 emome 註冊你的帳號. 然後進入我的帳單網頁查詢您的未出帳的資訊. 在進去 My mPro 程式計算目前剩餘通話量.

Tagged with:
Jun 11

HOWTO use jQuery in Dashcode?

在main.html內需要引入jquery-x.x.x.min.js檔案. 我是把jquery 當按放在 scripts 目錄內.所以main.html程式如下 :

1
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js" charset="utf-8"></script>

然後假設你在front panel裡面有個somebutton的按鈕. 按了一下之後使用 jquery 處理那個事件, 在 main.js 的程式碼如下(寫在檔案最後面) :

1
2
3
4
5
6
7
8
9
$(document).ready(function() {
    $("#somebutton").click(function(){
        $.get("http://www.samtseng.liho.tw/~samtz/blog/",
        function(txt){
            // processing txt;
            // 在這裡處理 jQuery get 回來的結果 (txt).
        });
    });
});

大致上這應就可以在 Dashcode 裡面使用 jQuery. :)

Tagged with:
Jun 03

程式目的 : 當使用者了按 checkbox 後, 才讓 delete button 啟用. 當使用者取消 checkbox 後, 將 delete button 停用.

html 程式碼如下 :

1
2
3
4
5
6
7
(omit)...
<input type="submit" id="delete" name="action" value="Delete users" disabled>
(omit)...
<input type="checkbox" name="uid[]" value="samtseng" onclick="enableAction();">
(omit)...
<input type="checkbox" name="uid[]" value="harrytseng" onclick="enableAction();">
(omit)...

用 jQuery 檢查每個 checkbox 是否被選取. 然後設定 button enabled/disabled. :)
javascript 程式碼如下 :

1
2
3
4
5
6
7
8
9
10
11
12
13
  function enableAction() {
    flag = false;
    $("input[type=checkbox][checked]").each(
      function() {
        flag = true;
      }
    );
    if (flag) {
      $("#delete").attr("disabled", false);
    } else {
      $("#delete").attr("disabled", true);
    }
  } // end function enableAction()

按這裡看DEMO.

Tagged with:
May 12

這個demo是使用 jQuery 呼叫 flickr api 顯示有關 貓 的 tags.

jQuery 程式部份如下 :

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript">
  $(document).ready(function() {
    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
    function(data){
      $.each(data.items, function(i,item){
        $("<img/>").attr("src", item.media.m).attr("border", 0).appendTo("#images") 
         .wrap("<a href='" + item.link + "'></a>");
        // if ( i == 3 ) return false;
      });
    });
  });
</script>

cssl 部份如下 :

1
2
3
4
5
6
<style type="text/css">
img {
    height: 200px;
    float: left;
}
</style>

html 部份如下 :

1
<div id="images"></div>

請看 DEMO

Tagged with:
May 07

這個主要是練習使用 jQuery 做 ajax POST 的動作.然後把結果塞回網頁上面.

先簡單寫個 helloworld 的 php. 限定它只接收 POST method.

1
2
3
4
5
6
7
<?
if (isset($_POST["name"])) {
    echo “aloha “.$_POST["name"];
} else {
    echo “get out!;
}
?>

在html內弄個區塊顯示回傳值:

1
<div class=”message”></div>

jQuery 部份只要寫下面給行 codes就可以達成 :

1
2
3
4
5
6
7
8
9
<script type=”text/javascript”>
    $(document).ready(function() {
        $.post(’helloworld.php,{
            name: “sam”
        }, function(txt){
            $(’div.message).html(txt);
        });
    });
</script>

這樣就完成了簡單的 jQuery 使用 ajax 呼叫POST method. 看一下 DEMO

Tagged with:
May 06

直接看 DEMO.

我是直接使用 Google 的 jQuery.

1
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

然後你要定義 table 的 css :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<style type="text/css">
    body {
        background: #ffffff;
    }
    table {
        border-collapse: collapse;
        width: 70%;
        font: 12px Verdana, Arial, Helvetica, sans-serif;
        text-align: center;
    }
    th {
        background: #3e83c9;
        color: #ffffff;
        font-weight: bold;
        padding: 2px 11px;
        border-right: 1px solid #ffffff;
    }
    td {
        padding: 6px 11px;
        border-bottom: 1px solid #95bce2;
        vertical-align: top;
    }
    td * {
        padding: 6px 11px;
    }
    tr.alt td {
        background: #ecf6fc;
    }
    tr.over td {
        background: #bcd4ec;
    }
</style>

設定 table 的一些屬性 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<table class="listview" border="0" align="center">
  <thead>
    <tr>
      <th>Name</th>
      <th>Height</th>
      <th>Weight</th>
      <th>Vegetarian</th>
      <th>Taiwanese</th>
      <th>English</th>
      <th>Japanese</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td width="22%">Sam</td>
      <td width="13%">183 cm</td>
      <td width="13%">82 kg</td>
      <td width="13%">V</td>
      <td width="13%">V</td>
      <td width="13%">V</td>
      <td width="13%">V</td>
    </tr>
  </tbody>
<table>

在用 jquery 加入 css 設定 :

1
2
3
4
5
6
7
8
9
10
<script type="text/javascript">
  $(document).ready(function() {
    $(".listview tr").mouseover(function() {
        $(this).addClass("over");
      }).mouseout(function() {
        $(this).removeClass("over");
      });
    $(".listview tr:even").addClass("alt");
  });
</script>
Tagged with:
Mar 25

用 screen.width 還有 screen.height 可以知道使用者螢幕的解析度. 在 javascript 內可以判別不同解析度導入不同頁面.

1
2
3
4
5
if ((screen.width >= 1024) && (screen.height >= 768)) {
    alert("High Resolution");
} else {
    alert("Low Resolution");
}
Tagged with:
Mar 16


透過 iTunes Library 的 Cover Flow 你們可以知道我都聽哪些音樂 :D 雖然你們不見得有興趣知道.

終於找到這隻程式. 但是, 還不能正常顯示中文. 看誰有 flash 的編輯器幫忙一下. 如果有那位善心人士. 能提供中文顯示的 .swf 感激不盡! 謝謝!

按這裡全螢幕顯示.

我在玩這個flash. 但是我一直搞不清楚要怎麼透過xml顯示中文.
我的xml 如下.

1
2
3
4
5
6
7
8
9
10
<?xml version=”1.0″ encoding=”utf-8″ ?>
<artworkinfo>
    <albuminfo>
        <artLocation>./getartwork.php?no=31</artLocation>
        <artist>合輯</artist>
        <albumName>放耳朵去流浪</albumName>
        <artistLink></artistLink>
        <albumLink></albumLink>
    </albuminfo>
</artworkinfo>

在 flash 內 action內設定了 System.useCodepage = false; or System.useCodepage = true; 都還是不能顯示中文.
在檔案的最前面也加入了 //!– UTF8
還有那個顯示的區塊也設定”新細明體”. 請問一下還有什麼可以設定. :$

如果你是 flash 達人請您教教我. 謝謝.

解決了!!!

因為 xml 本身是 utf-8. Flash CS4 內建也是用 unicode 所以不需要設定 System.useCodepage = true; 除非你要用 big-5.
再來就是要嵌入某些字集. 如下圖 :

黑皮!! 搞定了.


參考 : Flash iTunes Cover Flow – Version 2

Tagged with:
Feb 03
1
2
<input type="text" name="hostname" onblur="this.value = this.value.toLowerCase();">
<input type="text" name="macaddress" onblur="this.value = this.value.toUpperCase();">
Tagged with: