Domplate

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-13 21:41:55

软件介绍


Overview

The Domplate jquery plugin provides an advanced template system taken and modified from Firebug.

Features:

  • Templates are assembled via function calls instead of strings
  • User-defined callbacks to iterate and format data
  • Object oriented design allows for advanced hierarchies

NOTE: This plugin although functional has not had much actual use outside of the Firebug Firefox extension. It works well with Firefox but may have some problems with other browsers.

You can find more information here: http://code.google.com/p/domplate/
and here: http://www.christophdorn.com/Blog/category/domplate/

If you are interested in helping out to make this plugin cross-browser compatible, please express your interest on the discussion group.

Sample Code

<html>
<head>
  <script type="text/javascript" src="lib/jquery/jquery.js"></script>
  <script type="text/javascript" src="lib/jquery/jquery-domplate.js"></script>
<script>
$(document).ready(function(){
 
  with($.domplate) {
 
    var rep = $.domplate.create(
    {
      tpl: DIV({style:'border: 1px solid red; padding: 10px;'},
            FOR("item", "$items|arrayIterator",
              DIV({style:'border: 1px solid blue; margin-top: 5px; padding: 10px;'},'$item.msg')
            )),
   
      arrayIterator: function(array)
      {
        var items = [];
        for (var i = 0; i < array.length; ++i) {
          var value = array[i];
          items.push(value);
        }
        return items;
      }
    });
   
    var tpl = DIV({style:'border: 1px solid red; padding: 10px;'},'Hello World');
   
  }
   
  $('#body1').render(tpl);
 
  var items = [
               {msg:'Line1'},
               {msg:'Line2'}
              ];
 
  $('#body2').render(rep.tpl, {items:items}, rep);

});
</script>
</head>
<body>
<div id="body1"></div>
<div id="body2"></div>
</body>
</html>

本文地址:https://codercto.com/soft/d/23323.html

慕课革命

慕课革命

汤敏 / 中信出版社 / 2015-1-1 / 39.00元

《慕课革命》,国内唯一一本关于全方面了解慕课的权威著作,全面阐述慕课理念与中国实践。 林毅夫、俞敏洪、徐小平、王强作序推。 大规模在线教育的慕课革命大幕已经拉开,这是一场基于互联网及移动互联网的教育大变革。根据网易教育联合有道发起的《2013中国在线教育新趋势调查报告》揭示,中国在线教育正呈现出六大趋势,包括互联网成为人们获取知识的最常见渠道;移动端学习方式已经开始成为人们接受的学习方......一起来看看 《慕课革命》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具