<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html dir="ltr"> <head> <style type="text/css"> body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } </style> <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true, isDebug: true"> </script> <script type="text/javascript"> dojo.require("dijit.form.Button"); // this is just to make the demo look nicer var arr = [{ surname: "Washington", name: "Paul" }, { surname: "Gordon", name: "Amie" }, { surname: "Meyer", name: "Sofie" }, { surname: "Jaysons", name: "Josh" }, { surname: "Washington", name: "George" }, { surname: "Doormat", name: "Amber" }, { surname: "Smith", name: "Susan" }, { surname: "Hill", name: "Strawberry" }, { surname: "Washington", name: "Dan" }, { surname: "Dojo", name: "Master" }]; function filterArray() { var filteredArr = dojo.filter(arr, function(item) { return item.surname == "Washington"; }); dojo.forEach(filteredArr, function(item, i) { var li = dojo.doc.createElement("li"); li.innerHTML = i + 1 + ". " + item.surname + ", " + item.name; dojo.byId("filtered-items").appendChild(li); var tr = dojo.doc.createElement("tr"); var td = dojo.doc.createElement("td"); td.innerHTML = "abc汉字"; tr.appendChild(td); var td1 = dojo.doc.createElement("td"); td1.innerHTML = "abc汉字a"; tr.appendChild(td1); dojo.byId("myTbody").appendChild(tr); }); dojo.forEach(arr, function(item, i) { var li = dojo.doc.createElement("li"); li.innerHTML = i + 1 + ". " + item.surname + ", " + item.name; dojo.byId("unFiltered-items").appendChild(li); }); } </script> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" /> </head> <body class=" claro "> <button dojoType="dijit.form.Button" onClick="filterArray()" type="button"> Filter array </button> <div style="width: 300px; float: left;"> Filtered items <br /> (only people with "Washington" as surname) <ul id="filtered-items"> </ul> </div> <div style="width: 300px; float: left;"> Unfiltered items <br /> (all people are represented in the list) <ul id="unFiltered-items"> </ul> </div> <!-- NOTE: the following script tag is not intended for usage in real world!! it is part of the CodeGlass and you should just remove it when you use the code --> <script type="text/javascript"> dojo.addOnLoad(function() { if (document.pub) { document.pub(); } }); </script> <table> <thead> </thead> <tbody id="myTbody"> <tr><td>Table汉字</td></tr> </tbody> </table> </body> </html>
Tbody
最新推荐文章于 2025-08-10 06:12:57 发布