Archive for 12月, 2007

The Void

void, empty

I close my eyes
And nothing’s there.
Open once and open twice
Still I see the emptiness.
I wish it would go away
Be filled by something
But nothing fills the void.
An emptiness, a hole
My eyes are closed,
My dreams are gone
Once opened still I see
Nothing there for me.
The world, it still continues
But the void it grows and grows.
Others still have their dreams
But mine were taken from me
Swallowed by the void

過客

passenger

恰如林邊吹笛的過客,
樹影無聲的伴奏。
黑夜脫去它的罩衫,
可月光遮掩著不敢現身。
緊閉的門扉沒有動靜,
但燭光映著人影從紙窗中透出。

沒有人應門,
也沒有人敲門。

再想吹笛的時候,
才發現笛子早就發不出聲音了。
又或者,他從來不能發出什麼聲音。

沒有說話,
只有燭火還燃著。

#Cloudsan@ptt

Create optgroup element into select list with DOM

今天在研究使用 Ajax 透過 jQuery 動態建立 Optgroup 清單。
混沌兩個月,終於寫出稍微有用的文章了…

JavaScript

  1. var obj = document.getElementById("list");
  2.  
  3. $.getJSON("ajax.asp", {id: idx}, function(json){
  4.  
  5.   // if json data created...
  6.   if(json.length > 0) {
  7.  
  8.     // get json data of optgroup
  9.     for(var i=0; i<json .length; i++) {
  10.       var oGroup = document.createElement("optgroup");
  11.       // setting label attribute
  12.       oGroup.label = json[i].title;
  13.       // insert optgroup element to select list
  14.       obj.appendChild(oGroup);
  15.  
  16.       // get json data of option
  17.       for(var j=0; j<json[i].product.length; j++) {
  18.         oOption = document.createElement("option");
  19.         //setting title attribute
  20.         oOption.label = "Option1";
  21.         //setting value attribute
  22.         oOption.value = "Value of Option1";
  23.         //insert option element to select list
  24.         obj.appendChild(oOption);
  25.       }
  26.     }
  27.   }
  28. });

JSON Data Example

  1. [
  2.    {
  3.       title:'optgroup1',
  4.       product:[
  5.          {
  6.             id:1,
  7.             title:'Demo1',
  8.             price:100
  9.          },
  10.          {
  11.             id:2,
  12.             title:'Demo2',
  13.             price:200
  14.          }
  15.       ]
  16.    },
  17.    {
  18.       title:'optgroup2',
  19.       product:{
  20.          id:3,
  21.          title:'Demo3',
  22.          price:300
  23.       }
  24.    }
  25. ]

Reference

Technorati Tags: , ,

Lies

despair

Whatever, I don’t care anymore.

不回頭的話,究竟能走多遠呢?

turn

從小到大,沒幹過什麼偉大的事
或許該有個轉變、給自己一個期許
讓七零八落的人生,至少能有一個些微完整的角落

2008 年將至,讓今年劃下完美的句點。

Pages: Prev 1 2 3 4 5 6 7 8 Next

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.