页面的处理

实例一


<pre name="code" class="javascript">$("div ul li div a").click(function(){
	$("div ul li div a").each(function(){
		$(this).removeClass();
	});
	$(this).atr("class","here");

})
 
<div class="box_orange">
	<ul class="uls form">
		<li><label>规格</label></li>
		<div class="pre spec">
			<a her="javascript:void(0)" class="here">
				32G 黑色
			</a>
			<a her="javascript:void(0)" class="here">
				16G 白色
			</a>
		</div>
	</ul>
</div>

实例二


$("div ul li div a").click(function(){
	$("div ul li div a").each(function(){
		$(this).removeClass();
	});
	$(this).atr("class","here");

	var skuPrice =$(this).attr("marketPrice");
	var skuId = $(this).attr("skuId");

	$("#skuPrice").html("¥"+ skuPrice);
	$("#marketPrice").html("¥"+ marketPrice);
	$.ajax({
		url:"${path}/.../getStock.do",
		type:"post",
		dataType:"text",
		data:{
			skuId:skuId
		},
		success:function(responseText){
			if(responseText == "no"){
				$("#isStock").html("缺 货");
				$("#buyNow").hide();
				$("#addCart").hide();
			}else{
				$("#isStock").html("有 货");
				$("#buyNow").show();
				$("#addCart").show();
			}
		}
	});<pre name="code" class="javascript">$("div ul li div a:first").trigger("click");提交
})
 

上面的也可以获取样式的方式

$("div ul li div a").each(function(){
	var cssHere = $(this).attr("class");
	if(cssHere =="here"){
	$(this).trigger("click");
	}
})

市场价没有要给id 这里没有写

<div class="box_orange">
	<ul class="uls form">
		<li><label>规格</label></li>
		<div class="pre spec">
			<a her="javascript:void(0)" class="here">
				32G 黑色
			</a>
			<a her="javascript:void(0)" class="here">
				16G 白色
			</a>
		</div>
	</ul>
</div>
<input id="addCart" type="button" value="" class="hand bt138X40b" οnclick="add()" />
<input id="buyNow" type="button" value="" class="hand bt138X40b" οnclick="buy()" />

需要在c层点击需要查询库存  在后台写一个查询方法

@RequestMopping("/getStock.do")
	public void getStock(Long skuId,PrintWrite out){
		Ebsku ebsku =skuService.selectSkuById(skuId);
		String flag="no";
		if(ebsku.getStockInventory() > 0){
			flag ="yes";
		} 
	out.write(flag);
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值