JQuery一点使用记录

http://www.cnblogs.com/bynet/archive/2009/12/07/1618650.html

 

 

设置选中属性的样式

HTML结构:

 

 

<dl>
	<dt>商品颜色:</dt>
	<dd>
		<ul>
			<#list goodsDetailVo.wholesaleSellerGoods.subGoods as sku>
			<li><a href="javascript:" οnclick="setPrdClr($(this))">${(sku.value)!""}</a></li>
			</#list>
		</ul>
	</dd>
</dl>

 

JS : 先把同层级的所有样式清除,然后设置选中的元素的样式

 

	function setPrdSize(sze){
		sze.parent().parent().find("li").removeClass("current");
		sze.parent().addClass("current");
	}
	

 

在切换 显示 / 隐藏 页面元素的应用:

<tr style="display:none" class='hiddenRoom_www'>......</tr>
<tr style="display:none" class='hiddenRoom_www'>......</tr>
<tr style="display:none" class='hiddenRoom_www'>......</tr>
<tr style="display:none" class='hiddenRoom_www'>......</tr>
<tr style="display:none" class='hiddenRoom_www'>......</tr>
<tr style="display:none" class='hiddenRoom_www'>......</tr>

一个按钮控制这些元素的 "显示" / "隐藏" 状态 :

 

		if($('.hiddenRoom_www:first").is(":hidden")){
			$('.hiddenRoom_www').show();
			$('#i_'+classname).html("▲");
		}else{
			$('.hiddenRoom_www').hide();
			$('#i_'+classname).html("▼");
		}
		

 

"_www:first"  读取到列表的第一个元素,  .is(":hidden")   判断是不是隐藏状态.  然后做相应的处理 .

 

 

FORM 应用:

 

 

<form id="orderform" action="http://buyer.mall.woyo.com/getSellerGoodsSKU.action">
	<input type="hidden" name="lSellerGoodsId" value="${goodsDetailVo.sellerGoodsId}" />
	<input type="hidden" name="lSubGoodsId" value="${goodsDetailVo.subGoodsId}" />
	<input type="hidden" name="lSpecCombinationId" />
	<input type="hidden" name="nCount" />
	<input type="hidden" name="nChannelId" value="5" />
	<input type="hidden" name="strHttpUrl" value="http://biz.woyo.com/mall/shops/productdetail.action" />
</form>

 

 

JS :

function orderGoods(){
	$("#orderform").find("input[name='nCount']").val($("#buyNum").val());
	//alert($("#orderform").find("input[name='nCount']").val());
	$("#orderform").submit();
}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值