求一把商品放入购物车的网页特效.如下面订餐的效果
http://www.uunoon.com/ShopMessage.aspx?id=66&MansionId=&MansionName=%E6%9C%AA%E9%80%89%E5%AE%9A&ShopState=0
有用的代码,另开贴高分相送.

解决方案 »

  1.   

    找了一下
    ShopMenu.js里面
    用jquery做的。
    一个函数:
    function AjaxMenu(pageIndex,updateId,pagerId,url, opts) {
        var para = $.extend(options, opts, { pageIndex: pageIndex });
        var targerIds = { updateId: updateId, pagerId: pagerId };
        //alert(objTostr(opts));
        $.ajax({
            url: url,
            dataType: "json",
            data: para,
            success: function(msg) {
                //alert(objTostr(msg));
                if (msg.msg != null || msg.msg != undefined) {
                    var menu = "<table border='0' cellspacing='0' cellpadding='0'>";
                    var counter = 3;
                    var currentHours = new Date().getHours();
                    var currentMinute = new Date().getMinutes();
                    $.each(msg.msg.Head, function(i) {
                        if (counter == 3) {
                            menu += "<tr>";
                        }
                        var exhaustTime = msg.msg.Head[i].ExhaustTime.split(':');
                        if (msg.msg.Head[i].ExhaustTime == "" || parseInt(currentHours) > parseInt(exhaustTime[0]) || (parseInt(currentHours) == parseInt(exhaustTime[0]) && parseInt(currentMinute) > parseInt(exhaustTime[1]))) {
                            menu += "<td style='border-bottom:1px dashed #cccccc'><div rel='menuDiv' class='shopListA' onmouseover='this.className=\"shopListB\"' onmouseout='this.className=\"shopListA\"'><div style='padding:2px; border:1px solid #cccccc; width:133px; height:117px;'><img style='width:133px;height:117px;' src='" + msg.msg.Head[i].MenuImage.slice(2) + "' alt='" +
                            msg.msg.Head[i].MenuName + "' /></div><table><tr><td align='left' width='104'>" +
                            msg.msg.Head[i].MenuName + "</td><td align='right' width='35'><img onclick='RoleMenuReq(" + objTostr(msg.msg.Head[i]) + ",this)' style='cursor:pointer;' src='images/133.jpg' width='32' height='14'/></td></tr><tr><td align='left'>价格:<span style='color:red;'>" +
                            msg.msg.Head[i].MenuMoney + "</span>元</td></tr></table></div></td>";
                            if (counter == 0) {
                                menu += "</tr>";
                                counter = 4;
                            }
                            counter -= 1;
                        }
                    });
                    menu += "</table>";
                    //alert(menu);
                    $("#" + targerIds.updateId).html(menu);
                    Pager(pageIndex, msg.pageCount, targerIds.updateId, targerIds.pagerId, url, opts, "AjaxMenu");
                }
                else {
                    $("#" + targerIds.updateId).html("");
                    $("#" + targerIds.pagerId).html("");
                }
                parent.document.getElementById("Header").style.height = $(document).height() + "px";
                parent.document.getElementById("Header").style.width = $(document).width() + "px";
            },
            error: function() {
                if (parent.document.getElementById("Header")) {
                    parent.document.getElementById("Header").style.height = $(document).height() + "px";
                    parent.document.getElementById("Header").style.width = $(document).width() + "px";
                }
            },
            cache: false
        });
    }