gusucode.com > 爱美尔女性商城源码 1.0源码程序 > js/custom_pre_next.js

    $(document).ready(function() {
    var type = $().getParmByUrl("productType");
	var sort=$().getParmByUrl("OrderSort");
	var catID = $().getParmByUrl("cid");
	var pID = '0';
	var productType = '';
	if(type != undefined)
	{
	    productType = '&productType=' + type;
	}
	if(extend == '')
	{
	    pID = $().getParmByUrl("PID");
	}
	else
	{
	    var currentUrl = window.location.toString();
	    var startID = currentUrl.lastIndexOf('_') + 1;
	    var endID = currentUrl.lastIndexOf('.');
	    pID = currentUrl.substring(startID,endID);
	}
	
	if(sort == undefined || sort ==""){sort = "1";}
	if(catID == undefined || catID == ""){catID = "0";}

	var weburl = baseUrl + 'ajax.aspx?NoCopyright=1&type=GetPreNextProductID&PID=' + pID + '&catID=' + catID + '&OrderSort=' + sort + productType + '&ran=' + Math.random();
	$.get(weburl,function(data){
	    var preID = data.split('|')[0];
	    var nextID = data.split('|')[1];
	    var url = '';
	    var urlPara = '&cid=' + catID + '&OrderSort=' + sort;
	    if(extend == '')
	    {
	        url = baseUrl + 'Show.aspx';
	        if(preID != '0')
	        {
	            $('#preProduct').html('<a href="' + url + '?PID=' + preID + urlPara + productType + '"><img src="../images/pre_.gif"/></a>').addClass('pre_next_bg1');//上一个
	        }
	        else
	        {
	            $('#preProduct').html('<img src="../images/pre_.gif"/>').addClass('pre_next_bg2');//没有上一个商品时无链接
	        }
	        if(nextID != '0')
	        {
	            $('#nextProduct').html('<a href="' + url + '?PID=' + nextID + urlPara + productType + '"><img src="../images/next_.gif"/></a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	             $('#nextProduct').html('<img src="../images/next_.gif"/>').addClass('pre_next_bg2');//没有下一个商品时无链接
	        }
	    }
	    else
	    {
	        url = baseUrl + 'products/Product_';
	        urlPara = urlPara.substring(1);
	        urlPara = '?' + urlPara;
	        if(preID != '0')
	        {
	            $('#preProduct').html('<a href="' + url + preID + '.' + extend + urlPara + '">' + preProduct + '</a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	            $('#preProduct').html(preProduct).addClass('pre_next_bg2');
	        }
	        if(nextID != '0')
	        {
	            $('#nextProduct').html('<a href="' + url + nextID + '.' + extend + urlPara + '">' + nextProduct + '</a>').addClass('pre_next_bg1');
	        }
	        else
	        {
	             $('#nextProduct').html(nextProduct).addClass('pre_next_bg2');
	        }
	    }

	});
	
	
	
	
	
});