js ajax

获取子节点以及数组的建立

<script type="text/javascript">
$(document).ready(function(){
	$("table tr ").each(function(){
		$(this).children("td").each(function(){
		alert($(this).eq().val());	
		});
    //alert($(this).children("td:eq(0)").text());
    //alert($(this).children("td:eq(1)").text());
});
	var tdval= $("#tr1").children("td:eq(0)");
	//alert(tdval.text());
})
var mycars=new Array();
mycars[0]="一区";
mycars[1]="CH1506";
mycars[2]="桐乡市银通汽车销售服务有限公司";
var mycar1=new Array();
mycar1[0]="一区";
mycar1[1]="CH1506";
mycar1[2]="桐乡市银通汽车销售服务有限公司";
var mo=new Array();
mo[0]=mycars;
mo[1]=mycar1;
for (i=0;i<mo.length;i++){
	for (y=0;y<mo[i].length;y++){
 		document.write(mo[i][y] + "<br />");
	}
	 
}
</script>

判断浏览器:

判断语言

var browser = {
		versions : function() {
			var u = navigator.userAgent, app = navigator.appVersion;
			return {//移动终端浏览器版本信息
				trident : u.indexOf('Trident') > -1, //IE内核
				presto : u.indexOf('Presto') > -1, //opera内核
				webKit : u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
				gecko : u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
				mobile : !!u.match(/AppleWebKit.*Mobile.*/),//||!!u.match(/AppleWebKit/), //是否为移动终端
				ios : !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
				android : u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
				iPhone : u.indexOf('iPhone') > -1,// || u.indexOf('Mac') > -1, //是否为iPhone或者QQHD浏览器
				iPad : u.indexOf('iPad') > -1, //是否iPad
				webApp : u.indexOf('Safari') == -1
			//是否web应该程序,没有头部与底部
			};
		}(),
		language : (navigator.browserLanguage || navigator.language)
				.toLowerCase()
	}
	if (browser.versions.mobile) {
		location.href = 'http://m${web_dealer_domain}/${cityurl}';
	}

ajax三级别联动


$(function() {
	// "大区下拉框, 经销商类型下拉框"级联事件
	$("#regional, #dealerType").each(function() {
		$(this).bind("change", function() {
			$.ajax({
				url:"${yppam:url('findDealerByRegionalID')}",
				type:"post",
				data:"regionalID=" + $("#regional").val() + "&dealerType=" + $("#dealerType").val(),
				error:function() {
					alert('服务器繁忙~~请重试');
				}, success : function(data) {   
			 		$("#dealer").empty();
			 		$("#dealer").append("<option value=''>请选择</option>");   
					$.each(JSON.parse(data),function(key,value){
						 $("#dealer").append("<option value='"+value.id+"'>"+value.dealerName+"</option>");   
			 		});
			  	}
			});
		});
	});});


<td align="right" >所属经销商:</td>
<td colspan="3">
<span style="white-space:pre">	</span><select id="regional" name="regional" >
	<span style="white-space:pre">	</span><option value="" <c:if test="${condList.regional eq null}">selected="selected"</c:if>>请选择大区</option>
		<c:forEach var="regionals" items="${regionalList}">
		<span style="white-space:pre">	</span><option value="${regionals.id}" <c:if test="${condList.regional eq regionals.id}">selected="selected"</c:if>><span style="font-family: Arial, Helvetica, sans-serif;">${regionals.regionalName}</span><span style="font-family: Arial, Helvetica, sans-serif;"></option></span>
			</c:forEach>
	</select>
	<select id="dealerType" name="dealerType">
		<option value="" <c:if test="${condList.dealerType eq null}">selected="selected"</c:if>>请选择类型</option>
		<option value="1" <c:if test="${condList.dealerType eq 1}">selected="selected"</c:if>>经销商</option>
		<option value="0" <c:if test="${condList.dealerType eq 0}">selected="selected"</c:if>>非经销商</option>
	</select>
	<select id="dealer" name="dealer" style="width: 150px;">
		<option value="" <c:if test="${condList.dealer eq null}">selected="selected"</c:if>>请选择</option>
		<c:forEach var="dealers" items="${dealerList}">
			<option value="${dealers.id}"	
<span style="white-space:pre">			</span><c:if test="${condList.dealer eq dealers.id}">selected="selected"</c:if>>${dealers.dealerName}</option>
		</c:forEach>
	</select>
</td>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值