Blog信息 |
blog名称: 日志总数:1304 评论数量:2242 留言数量:5 访问次数:7593756 建立时间:2006年5月29日 |

| |
[Prototype(Ajax)]Spry Framework入门(二)——XML数据集及主从表显示 软件技术
lhwork 发表于 2007/1/18 10:50:00 |
简介: Spry Framework是Adobe出品的轻量级的支持Ajax的JavaScript库,以HTML为中心,使用最基本的HTML、CSS和JavaScript来实现丰富Web页面体验。试验环境:操作系统:windows2003 Server浏览器:IE7.0 RC1 FireFox 1.5.0.7WEB服务器:IIS 6.0Spry库:Spry_P1_3_08-11安装:从http://labs.adobe.com/technologies/spry/ 下载安装包,目前版本为Spry_P1_3_08-11.zip,解开后把includes目录复制到自己的IIS虚拟目录上即可。页面代码:test.html
1500)this.width=500'><head> 2500)this.width=500'> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 3500)this.width=500'> <title>Spry Example</title> 4500)this.width=500'> 5500)this.width=500'> <!--Link the Spry libraries--> 6500)this.width=500'> <script type="text/javascript" src="includes/xpath.js"></script> 7500)this.width=500'> <script type="text/javascript" src="includes/SpryData.js"></script> 8500)this.width=500'> 9500)this.width=500'> <!--Create a data set object-->10500)this.width=500'>500)this.width=500'> <script type="text/javascript">500)this.width=500'>11500)this.width=500'> var dsSpecials = new Spry.Data.XMLDataSet("data.xml", "specials/menu_item");12500)this.width=500'>500)this.width=500'> var dsIngredients = new Spry.Data.XMLDataSet('500)this.width=500'>{dsSpecials::url}', "item/ingredients/ingredient");13500)this.width=500'> </script>14500)this.width=500'></head>15500)this.width=500'>16500)this.width=500'><body>17500)this.width=500'>18500)this.width=500'> <!--Create the Spry dynamic region-->19500)this.width=500'> <div id="Specials_DIV" spry:region="dsSpecials">20500)this.width=500'> <!--Display the data in a table-->21500)this.width=500'> <table id="Specials_Table">22500)this.width=500'> <tr>23500)this.width=500'> <th>名称</th>24500)this.width=500'> <th>Description</th>25500)this.width=500'> <th>价格</th>26500)this.width=500'> </tr>27500)this.width=500'> <!--<tr spry:repeat="dsSpecials">-->28500)this.width=500'> <tr spry:repeat="dsSpecials" onclick="dsSpecials.setCurrentRow('{ds_RowID}')">29500)this.width=500'> <td>{item}</td>30500)this.width=500'> <td>{description}</td>31500)this.width=500'> <td>{price}</td>32500)this.width=500'> </tr>33500)this.width=500'> </table>34500)this.width=500'> </div>35500)this.width=500'><hr>36500)this.width=500'> <!--Create the detail dynamic region-->37500)this.width=500'> <div id="Specials_Detail_DIV" spry:region="dsIngredients">38500)this.width=500'> <table id="Specials_Detail_Table">39500)this.width=500'> <tr>40500)this.width=500'> <th>Ingredients</th>41500)this.width=500'> </tr>42500)this.width=500'> <tr spry:repeat="dsIngredients">43500)this.width=500'> <td>{name}</td>44500)this.width=500'> </tr>45500)this.width=500'> </table>46500)this.width=500'> </div>47500)this.width=500'></body>data.xml
500)this.width=500'><?xml version="1.0" encoding="UTF-8"?>500)this.width=500'><specials>500)this.width=500'> <menu_item id="1">500)this.width=500'> <item>夏日沙拉</item>500)this.width=500'> <description>organic butter lettuce with apples, blood oranges, gorgonzola, and raspberry vinaigrette.</description>500)this.width=500'> <price>7</price>500)this.width=500'> <url>summersalad.xml?id=1</url>500)this.width=500'> </menu_item>500)this.width=500'> <menu_item id="2">500)this.width=500'> <item>Thai Noodle Salad</item>500)this.width=500'> <description>lightly sauteed in sesame oil with baby bok choi, portobello mushrooms, and scallions.</description>500)this.width=500'> <price>8</price>500)this.width=500'> <url>thainoodles.xml</url>500)this.width=500'> </menu_item>500)this.width=500'> <menu_item id="3">500)this.width=500'> <item>Grilled Pacific Salmon</item>500)this.width=500'> <description>served with new potatoes, diced beets, Italian parlsey, and lemon zest.</description>500)this.width=500'> <price>16</price>500)this.width=500'> <url>salmon.xml</url>500)this.width=500'> </menu_item>500)this.width=500'></specials>summersalad.xml
500)this.width=500'><?xml version="1.0" encoding="UTF-8"?>500)this.width=500'><item>500)this.width=500'> <item_name>Summer salad</item_name>500)this.width=500'> <ingredients>500)this.width=500'> <ingredient>500)this.width=500'> <name>butter lettuce</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>Macintosh 苹果</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>Blood oranges</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>Gorgonzola cheese</name>500)this.width=500'> </ingredient>500)this.width=500'> </ingredients>500)this.width=500'></item>thainoodles.xml
500)this.width=500'><?xml version="1.0" encoding="UTF-8"?>500)this.width=500'><item>500)this.width=500'> <item_name>Thain Noodles</item_name>500)this.width=500'> <ingredients>500)this.width=500'> <ingredient>500)this.width=500'> <name>Thain Noodle</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>Macintosh apples</name>500)this.width=500'> </ingredient>500)this.width=500'> </ingredients>500)this.width=500'></item>salmon.xml
500)this.width=500'><?xml version="1.0" encoding="UTF-8"?>500)this.width=500'><item>500)this.width=500'> <item_name>Salmon</item_name>500)this.width=500'> <ingredients>500)this.width=500'> <ingredient>500)this.width=500'> <name>Salmon</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>parsley</name>500)this.width=500'> </ingredient>500)this.width=500'> <ingredient>500)this.width=500'> <name>basil</name>500)this.width=500'> </ingredient>500)this.width=500'> </ingredients>500)this.width=500'></item> |
|
|