zoukankan      html  css  js  c++  java
  • php 展示本类别产品,同时指示当前产品的位置,可以手动左右滚动

    代码
    <SCRIPT language=javascript 
    src
    ="../js/ae.js"></SCRIPT> 

    <SCRIPT 
    src
    ="../js/aisn.js" 
    type
    =text/javascript></SCRIPT> 

    <SCRIPT language=javascript 
    src
    ="../js/minisite.js" 
    type
    =text/javascript></SCRIPT> 
    <STYLE type=text/css media=all> 
    @import url( http://localhost/css/styleG21.css ); 
    </STYLE> 
    <?php 
    if ($make2html_mode==1){ 
    $articleid
    =$articleid2htm; 
    }
    else
    $articleid 
    = trim($_REQUEST['articleid']); 

    if ($_REQUEST['preview']=="yes"){ 
    $articleid 
    = trim($_REQUEST['articleid']); 

    mysql_select_db($database_lr, $lr); 
    $sql 
    = "select * from product where articleid='$articleid'"
    $result 
    = mysql_query( $sql ); 
    $res_now 
    = mysql_fetch_array($result);//不能用mysql_fetch_row 
    $r_bigclassid=$res_now['bigclassid']; 
    $r_smallclassid
    =$res_now['smallclassid']; 
    $string_bigpic
    =$res_now['bigpic']; 
    $strbigpic
    =split(",",$string_bigpic); 
    $string_otherpic
    =$res_now['otherpic']; 
    $query
    ="select count(*) from product where bigclassid='$r_bigclassid'"
    $rs
    =mysql_query($query); 
    $myrow 
    = mysql_fetch_array($rs); 
    $numrows
    =$myrow[0]; 
    ?> 
    <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center"> 
    <tr> 
    <td> 


    <DIV class=ProductGroup id=inSearch name="inSearch"> 
    <DIV class=ProductGroupOthers> 
    <DIV class=ProductGroupBack><A class=disable id=itemViewerPre 
    style
    ="VISIBILITY: hidden" href="javascript:void(0);"></A></DIV> 
    <DIV class=productGroupOthersRind> 
    <DIV class=productGroupOthersCotainer id=itemViewerContainer> 

    <?php 
    // 

    $exec
    =mysql_query("Select articleid,(@rowNum:=@rowNum+1) as rowNo From product, 
    (Select (@rowNum :=0) ) b where bigclassid='$r_bigclassid' Order by product.product_id
    "); 
    $rows
    =mysql_num_rows($exec); 
    $rs
    =mysql_fetch_array($exec); 

    do { 
    if($rs['articleid']==$articleid) 

    $inum
    =$rs['rowNo']; 


    while ($rs = @mysql_fetch_array($exec)); 
    $current_num
    =$inum-1
    //代码中间有一些变量不能与其他重复,这个很重要 
    mysql_select_db($database_lr, $lr); 
    $sql_gundong2
    =mysql_query("select * from product where bigclassid='$r_bigclassid' order by product_id "); 
    if ($rs_gundong2 = mysql_fetch_array($sql_gundong2)) 

    $j
    =0
    do { 
    $j
    =$j+1
    $smallpic_width
    =80
    $w
    =$rs_gundong2['swidth']; 
    $h
    =$rs_gundong2['sheight']; 
    $m
    =$w/$smallpic_width; 
    $n=$h/$smallpic_width; 

    if ($w>=$smallpic_width or $h>=$smallpic_width){ 
    if ($m>$n) { 
    $w1
    =$smallpic_width; 
    $h1
    =$h/$m;} 
    elseif ($m<$n) { 
    $h1
    =$smallpic_width; 
    $w1
    =$w/$n;} 
    else
    $w1
    =$smallpic_width; 
    $h1
    =$smallpic_width; 


    }
    else
    $w1
    =$w; 
    $h1
    =$h; 
    }; 

    $sql2 
    = "select * from bigclass where bigclassid='$r_bigclassid'"
    $result2 
    = mysql_query( $sql2 ); 
    $res_now 
    = mysql_fetch_array($result2);//不能用mysql_fetch_row 
    $productshow_bigclassname=tihuan($res_now['bigclassname']); 

    switch ($productshowhtmlname) 

    case "3"
    $productshowname2
    =$productshow_bigclassname."_".$productshow_smallclassname."_".$rs_gundong2['articleid']; 
    break
    case "2"
    $productshowname2
    =$rs_gundong2['articleid']; 
    break
    case "1"
    $productshowname2
    =$rs_gundong2['product_id']."_".$rs_gundong2['articleid']; 
    break
    case "0"
    $productshowname2
    =$rs_gundong2['product_name']."_".$rs_gundong2['articleid']; 


    ?> 
    <DIV class=productGroupOthersItem><a href="../html/<?php echo $productshowname2?>.html"><img src="<?php echo $rs_gundong2['smallpic']?>" width="<?php echo $w1?>" height="<?php echo $h1?>" border="0" alt="<?php echo $rs_gundong2['product_id']?>"/></a><SPAN 
    class
    =s><a href="../html/<?php echo $productshowname2?>.html"><?php echo $rs_gundong2['product_id']?></a></SPAN> 
    </div> 
    <?php } 
    while ($rs_gundong2 = @mysql_fetch_array($sql_gundong2)); 

    ?> 









    </DIV></DIV> 
    <DIV class=ProductGroupNext><A class=disable id=itemViewerNext 
    style
    ="VISIBILITY: hidden" href="javascript:void(0);"></A></DIV></DIV> 


    <SCRIPT type=text/javascript rel="nofollow"> 
    var otherProduct = new AE.run.minisite.productViewer(); 
    var otherProductConfig=
    startEnd:[
    0,<?php echo $numrows-1?>], 
    thisIndex:
    <?php echo $current_num?>,//当前的产品在本类别的顺序,从0开始计数 
    itemSize:[90,42], 
    itemCount:
    <?php echo $numrows?>
    step:
    7
    animTime:
    1
    orientation:
    "w"
    fireFunction:YAHOO.util.Easing.easeBothStrong, 
    itemContainerId:
    "itemViewerContainer"
    itemClassName:
    "productGroupOthersItem"
    preBtnId:
    "itemViewerPre"
    nextBtnId:
    "itemViewerNext"
    getDataUrl:
    "/request_related_products.html?iframe_delete=true&companyId=200658099&memberId=fsjingfu&showimg=false&groupId=209618128&productCategoryId=30101&productId=268701662"
    updateItemCount:
    14 

    otherProduct.onDisableNext.subscribe(afterDisableNext); 
    otherProduct.onDisablePre.subscribe(afterDisablePre); 
    otherProduct.onEnableNext.subscribe(afterEnableNext); 
    otherProduct.onEnablePre.subscribe(afterEnablePre); 
    function afterDisableNext(){ 
    get(
    'itemViewerNext').className="disable"

    function afterDisablePre(){ 
    get(
    'itemViewerPre').className="disable"

    function afterEnableNext(){ 
    get(
    'itemViewerNext').className=""

    function afterEnablePre(){ 
    get(
    'itemViewerPre').className=""

    YUE.on(window,
    "load",function(){otherProduct.init(otherProductConfig);}); 
    </SCRIPT> 
    </DIV> 
    </td> 
    </tr> 
    </table> 
    注意css文件一定要用网页完整路径引用,其中有一个重要的部分,就是当前产品的序号,也就是mysql记录中当前行号 
    $exec
    =mysql_query("Select articleid,(@rowNum:=@rowNum+1) as rowNo From product, 
    (Select (@rowNum :=0) ) b where bigclassid='$r_bigclassid' Order by product.product_id
    "); 
    $rows
    =mysql_num_rows($exec); 
    $rs
    =mysql_fetch_array($exec); 

    do { 
    if($rs['articleid']==$articleid) 

    $inum
    =$rs['rowNo']; 


    while ($rs = @mysql_fetch_array($exec)); 
    $current_num
    =$inum-1
    需要的JS和css文件 
    http:
    //www.corange.cn//uploadfiles/js_alibaba_69828.rar 

    原文地址:http:
    //
  • 相关阅读:
    Eclipse下安装Pydev以及Helloworld实例 分类: Python 2015-07-23 23:30 29人阅读 评论(0) 收藏
    Eclipse下安装Pydev以及Helloworld实例
    Selenium学习笔记之013:控制滚动条到底部
    iOS开发Embedded dylibs/frameworks are only supported on iOS 8.0 and later for architecture armv7的解决方法
    UIView 和 CALayer 的区别和联系。
    iOS 防止数组越界的解决方法
    iOS中集成ijkplayer视频直播框架
    解析数据时,快速查看当前需要创建的数据模型的所有属性,不用每个都写,直接打印粘贴
    iOS开发中,能够方便使用的Xcode插件
    UIButton图片拉伸方法(很多需要按钮的地方我们只需要一张小图来进行缩放)
  • 原文地址:https://www.cnblogs.com/zerogo/p/1726907.html
Copyright © 2011-2022 走看看