Ajax改造:使用Ajax和jQuery改进现有站点(7)
来源:PHP100 发布时间:2010-04-02 12:50:00
清单 6. 用于 Customize Me Now 2.0 导航的 HTML 代码
<noscript>
<div id="footer" class="nav">
<<ul>
<li><a href="index.html">search&/a></li>
<li><a href="results.html">results</a></li>
<li><a href="detail.html">details</a></li>
<li><a href="comparison.html">compare</a></li>
<li><a href="customize.html">customize</a></li>
<li><a href="cart.html">cart</a></li>
<li><a href="checkout.html">checkout</a></li>
<li class="last"><a href="confirm.html">confirmation</a></li>
</ul>
</div>
</noscript>
Product Details 页面的主要内容 <div> 的 HTML 代码与清单 7 中的代码类似。
清单 7. details.html 2.0 的 HTML 代码
<div id="main" class="inline">
<form method="GET" action="customize.html">
<input type="hidden" name="product" id="product" value="A" />
<h1>Pizza: Product Details</h1>
<noscript>
<div class="buttons">
<input class="button" type="submit" name="submitTop" id="submitTop"
value="Customize Now" />
or <a href="cart.html?product=A">add to cart with default
options</a>
</div>
</noscript>
<!--[content goes here]-->
<noscript>
<div class="buttons">
<input class="button" type="submit" name="submitBottom" id="submitBottom"
value="Customize Now" />
or <a href="cart.html">add to cart with default options</a>
</div>
</noscript>
</form>
</div>
Comparison 页面的主要内容 <div> 的 HTML 代码与清单 8 中的代码类似。
清单 8. comparison.html 2.0 的 HTML 代码
<div id="main" class="inline">
<h1>Product Comparison</h1>
<table class="productComparison">
<thead>
<tr>
<th>Product</th>
<th>Pros</th>
<th>Cons</th>
<noscript>
<th>Actions</th>
</noscript>
</tr>
</thead>
<tr>
<td class="name">
<a class="jTip" name="About Pizza" id="pizza" target="productPopup"
href="productPopup.html?product=A">Pizza</a>
</td>
<td class="pros">
<ul>
<li>Great flavor.</li>
<li>Low cost.</li>
<li>Fun with friends.</li>
</ul>
</td>
<td class="cons">
<ul>
<li>Can make you fat.</li>
<li>Not very nutritious.</li>
</ul>
</td>
<noscript>
<td class="action">
<a class="button" href="customize.html?product=A">customize
product</a>
<a class="button" href="cart.html?product=A">add to cart with
default options</a>
</td>
</noscript>
</tr>
<!--[additional table rows here]-->
</table>
</div>
在浏览器中查看 Customize Me Now 2.0 Search Results 页面并启动 Product Details 或 Comparison 页面,您可以看到所有的改进结果。其结果应该与图 3 类似。
图 3. 运行中的 ThickBox
结束语
尽 管本文涵盖了大量内容 — 向您展示了一些 Ajax 技术和最佳实践 —— 但是我们才刚刚开始。在本系列的第 2 部分中,您将使用 JTip 将弹出链接转换为工具提示,继续改善您的导航。然后,将使用 GreyBox 将 off-site 链接转换为 lightbox。最后,回顾一下示例应用程序背后的所有关键概念,并分析如何使用它们改善用户体验。如果您还想继续学习,您可以更深入地研究 Customize Me Now 2.0 的源代码,并在 Web 浏览器中查看实际效果。


猜你喜欢
- 在本节中将会给Movie模型添加验证逻辑。并且确保这些验证规则在用户创建或编辑电影时被执行。保持事情 DRYASP.NET MVC 的核心设
- 一,通用的ASCII码对照表 图解ASCII码对照表图,以字符A为例Dec表示十进制,如65Hx表示十六进制,如41Oct表示八进制,如10
- 有一个多选的需求,在网上找到了这个插件:multiselect https://github.com/ehynds/jquery-ui-mu
- 假设有2个有序列表l1、l2,如何效率比较高的将2个list合并并保持有序状态,这里默认排序是正序。思路是比较简单的,无非是依次比较l1和l
- 本文实例讲述了Django实现简单分页功能的方法。分享给大家供大家参考,具体如下:使用django的第三方模块django-pure-pag
- Python作为一种功能强大的编程语言,因其简单易学而受到很多开发者的青睐。那么,Python 的应用领域有哪些呢?概括起来,Python的
- 1.小猫运动游戏源码# @Author : 辣条'''多行注释本程序运行后会有一只小猫向前走安装模块 pip ins
- With语句是什么?有一些任务,可能事先需要设置,事后做清理工作。对于这种场景,Python的with语句提供了一种非常方便的处理方式。一个
- MySQL批量插入数据脚本#!/bin/bashi=1;MAX_INSERT_ROW_COUNT=$1;while [ $i -le $MA
- Linux环境MySQL服务器级优化讲解 摘要:本节简单介绍了如何在服务器级优化数据库的性能
- 这是我的数据库student,好比输入一个值为32,查询id最接近32的整行数据,可以用以下代码import pymysqlvalue=32
- <?php /** 默认首页 **/ class DefaultController extends AppController {
- 支持lrc歌词,IE only 代码未加密且有详细注释,希望对做音乐页面的朋友有帮助。 如果大家还有什么好多播放器,告诉我,我好参
- 本文实例讲述了CodeIgniter分页类pagination使用方法。分享给大家供大家参考,具体如下:controller控制器(appl
- zip即将多个可迭代对象组合为一个可迭代的对象,每次组合时都取出对应顺序的对象元素组合为元组,直到最少的对象中元素全部被组合,剩余的其他对象
- 1. 数据集基本信息df = pd.read_csv()df.head():前五行;df.info():rangeindex:行索引;dat
- 本文实例讲述了python使用opencv实现马赛克效果。分享给大家供大家参考,具体如下:最近要实现opencv视频打马赛克,在网上找了一下
- Q1 :如何解压 rar 压缩包文件?A :Step1:检查是否有 rarfile 第三方库,若没有该模块,则需要进行安装 ;Step2:参
- python random库简单使用demo当我们需要生成随机数或者从一个序列中随机选择元素时,可以使用 Python 内置的 random
- 这样处理的弊端是:如果数据量大,子分类很多,达到4级以上,这方法处理极端占用数据库连接池 对性能影响很大。 如果用SQL下面的CTE递归处理