2007-01-10
JsonML を使う高速テンプレートエンジン「JsonML.Template」
というのを作ってみた
JsonML とは
使いかた
// テンプレートの作成 // <div class="section"><h2>タイトル</h2><p>本文本文本文</p></div> var t = $T(['div', {class: 'section'}, ['h2', 'タイトル'], ['p', '本文本文本文本文'] ]); // 要素の生成 document.body.appendChild(t()); // 呼び出すだけ
// テンプレートの作成 var t = $T(['div', {class: 'section'}, ['h3', function(c){return c.getVar('title')}], // タイトルを動的に生成 ['p', function(c){return c.getVar('content')}] // コンテンツを動的に生成 ]); button.onclick = function(title, content) { document.body.appendChild(t({title: title, content: content})); // 変数付きで呼び出す };
詳しくは、このリンクを参照してください。
トラックバック - http://d.hatena.ne.jp/amachang/20070110/1168411701
リンク元
- 168 http://www.google.co.jp/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-32,GGGL:ja&q=firebug
- 146 http://www.google.co.jp/search?hl=ja&q=FireBug&btnG=Google+検索&lr=
- 107 http://reader.livedoor.com/reader/
- 64 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rls=GGLJ,GGLJ:2006-44,GGLJ:ja&q=ブログバトラー
- 47 http://fnya.cocolog-nifty.com/blog/
- 33 http://www.google.co.jp/search?q=firebug&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a
- 29 http://lab.urume.net/2006,0916,530.html
- 20 http://fnya.cocolog-nifty.com/blog/05ajaxjavascript/index.html
- 20 http://labs.unoh.net/2006/10/dojoioscriptsrcioajax.html
- 18 http://www.google.co.jp/search?sourceid=navclient&aq=t&hl=ja&ie=UTF-8&rls=GGLJ,GGLJ:2006-44,GGLJ:ja&q=javascript+デバッグ
