jQuery + XML + XSL 相册 

示例地址如下:

http://files.cnblogs.com/mady55/jQuery+XML+XSL相册.rar

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="myworks.xsl"?>
<works>
 <web>
  <pic small="images/2s.jpg" big="images/2b.jpg">Jobeller</pic>
  <pic small="images/2s.jpg" big="images/2b.jpg">1 Enyo</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">2</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">3</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">4</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">5</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">6</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">7</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">8</pic>
  <pic small="images/2s.jpg" big="images/1b.jpg">8</pic>
 </web>
</works>

 

下面是xsl 文件

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html>
      <head>
        <link rel="Stylesheet" href="css/style.css" type="text/css"/>
        <script type="text/javascript" src="js/unitpngfix.js"></script>
        <script type="text/javascript" src="js/jquery-1.2.6.js"></script>
        <script type="text/javascript">
          var imgSrc = "";
          jQuery(document).ready(function(){

          jQuery(".weblist img").click(weblist_Img_Click);
          jQuery("#imgBack,#bigback").click(showbigpicHide);

          jQuery(".showbigpic").animate({
          left:"-=746px",
          opacity:"toggle"
          },1);

          jQuery("#bigback").load(Img_Load);
          });

          function Img_Load(){
          jQuery("#imgLoading").hide();
          jQuery("#bigback").show();
          }


          function weblist_Img_Click(e)
          {

          imgSrc = jQuery(e.target).parent().attr("href");
          if(jQuery(".showbigpic").is(":visible"))
          {
          showbigpicHide();
          }
          else
          {

          jQuery("#imgLoading").show();
          jQuery("#bigback").hide();
          jQuery("#bigback").attr("src",jQuery(e.target).parent().attr("href"));
          }


          showbigpicShow();

          return false;
          }

          function showbigpicShow()
          {
          jQuery(".showbigpic").animate({
          left:'+=746px',
          opacity:"toggle"
          },500);

          }

          function showbigpicHide()
          {
          jQuery(".showbigpic").animate({
          left:"-=746px",
          opacity:"toggle"
          },500,"",function(){
          jQuery("#imgLoading").show();
          jQuery("#bigback").hide();
          jQuery("#bigback").attr("src",imgSrc);
          });
          }
        </script>
      </head>
      <body>
        <div id="world">
          <div id="header">
  
          </div>
          <div class="showbigpic">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="3" class="showbigtop"></td>
              </tr>
              <tr>
                <td bgcolor="#ffffff" class="showbigcon">
                  <img id="imgLoading" src="images/loading.gif"  />
                  <img src="images/2b.jpg" id="bigback"  />
                </td>
                <td width="38" bgcolor="#ffffff">
                  <a href="javascript:void(0)">
                    <img src="images/back.gif" id="imgBack" alt="返回" />
                  </a>
                </td>
                <td width="22" class="showbigrig"></td>
              </tr>
              <tr>
                <td colspan="3" class="showbigbtm"></td>
              </tr>
            </table>
          </div>

          <p class="sort">
            <img src="images/webtitle.gif" alt="Web Design"/>
          </p>
          <ul class="weblist">

            <xsl:for-each select="works/web/pic">
              <li>
                <xsl:element  name="a">

                  <xsl:attribute name="href">
                    <xsl:value-of select="@big" />
                  </xsl:attribute>

                  <xsl:attribute name="title">
                    <xsl:value-of select="." />
                  </xsl:attribute>

                  <xsl:element  name="img">
                    <xsl:attribute name="src">
                      <xsl:value-of select="@small" />
                    </xsl:attribute>
                  </xsl:element>

                </xsl:element>
              </li>
            </xsl:for-each>

          </ul>
          <p class="clear"></p>

          <p class="sort">
            <img src="images/logotitle.gif" alt="Web Design"/>
          </p>


        </div>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>
 

转载于:https://www.cnblogs.com/mady55/archive/2009/04/24/1442678.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值