IE6、IE7、IE8对多级jquery属性选择器失效的替代方案

 1  $.ajax({
2 type: "Post",
3 url: "BdQuotation.aspx/GetGoodsInfo",
4 data: "{'goodsId':'"+value+"'}",
5 contentType: "application/json; charset=utf-8",
6 dataType: "json",
7 success: function(data){
8 var jsonData=eval(data.d);
9 $.each(jsonData.goodsInfo,function(index,item){
10 subDataTable.setCurrentValueByName(item.name,item.value);
11 // $('input[type=text][rowIndex='+e.rowIndex+'][fieldName='+item.name+']').val(item.value);
12 var inputs=document.getElementsByTagName('input');
13 for(var i=0;i<inputs.length;i++){
14 if(inputs[i].getAttribute('rowIndex')==e.rowIndex&&inputs[i].getAttribute('fieldName')==item.name){
15 inputs[i].setAttribute('value',item.value);
16 }
17 }
18 });
19 },
20 error: function(err){
21 alert(err);
22 }
23 });

  原本用 $('input[type=text][rowIndex='+e.rowIndex+'][fieldName='+item.name+']').val(item.value);   但是只有在IE9中才支援這樣的寫法。在這邊只能用原生態的JS來寫了。

posted @ 2011-08-11 16:25  lzone6  阅读(2866)  评论(0编辑  收藏  举报