jqury each的使用

<!--
path:/WEB-INF/jsp/llistemplate/editLlistTemplate.jsp
-->
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="newstag" uri="http://www.sobey.com/news/taglib/news"%>
<%@ include file="/common/taglibs.jsp"%>
<link href="<c:url value='/themes/${userPageConfig.themename}/styles/style.css' />" rel="stylesheet" type="text/css" media="screen" />
<link href="<c:url value='/themes/${userPageConfig.themename}/styles/style.css' />" rel="stylesheet" type="text/css" media="print" />
<script type="text/javascript" src="<c:url value="/widgets/ext/ext-all.js"/>"></script>
<script type="text/javascript" src="<c:url value="/widgets/ext/examples.js"/>"></script>
<script type="text/javascript" src="<c:url value="/widgets/ext/source/locale/${userPageConfig.language}/ext-lang.js"/>"></script>
<%@ include file="/widgets/tree/treeV3.jsp"%>
<%@ include file="/widgets/listmember/memberList.jsp"%>
<%@ include file="/common/fileUpDown.jsp"%>
<link href="<%=request.getContextPath()%>/widgets/tree/list/list.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/widgets/tree/list/list.js"></script>
<script type="text/javascript" src='<c:url value="/scripts/commonInAllPage.js"/>'></script>

<%@ include file="/common/columndiv_noconfig.jsp"%>
<script type="text/javascript">
var rootPath="<%=request.getContextPath()%>";
</script>
<script src="<%=request.getContextPath()%>/widgets/treeclassify/jquery.js"></script>
<link href="<c:url value='/css/button/button.css' />" rel="stylesheet" type="text/css" />
<style type="text/css">
#mytable {
width: 100%;
padding: 0;
margin: 0;
}

th {
font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: left;
padding: 6px 6px 6px 12px;
background: #CAE8EA  no-repeat;
}

td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
font-size:11px;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}

</style>
<script type="text/javascript">
  var doctaskid=0;
  var x = 0;
  function submitMethod(doctaskid){
  Ext.MessageBox.confirm('',"<h3>确定提交此任务吗?</h3>",
function(btn){
if(btn=="yes"){
  Ext.Ajax.request({
  method:"POST",
  encoding:"UTF-8",
  url:rootPath + "/project/pretask2Submit.do?iscommand=true&project.id="+doctaskid,
  success:function(response,options){
     var json = Ext.util.JSON.decode(response.responseText);
     Ext.alert.msg('',json.returnMessage);
     if(json.message=="成功提交任务!"){
     //alert("ext  " +doctaskid);
    // var urlPath = rootPath + "/project/pretask2Submit.do?iscommand=true&project.id="+doctaskid;
    //LayoutA.showContent2NewPanel('',urlPath, true,41, null);
}
      },
      failure:function(result,request){
      Ext.alert.msg('', "任务提交失败",'error');
      }
  });
}
});
  }
 
  function pre2submit(){
$('#mytable tr').each(function(i,d){
         var $tr = $(d);
         var $td = $tr.children(':first-child');
var $input = $td.children('input');
alert($input.attr('checked') && x==0);
if($input.attr('checked')==null && x==0){
            Ext.alert.msg('tip',"请选择一条数据",'warn');
            return;
     }
if ($input.attr('checked')) {
/*alert($tr.find(".displayname").text());
alert($tr.find(".uncpath").text());
alert($tr.find(".id").val());
alert($tr.find(".clipguid").val());
alert($tr.find(".resourcetype").val());
alert($tr.find(".parentid").val());*/
var doctaskid = $tr.find(".doctaskid").val();
x=1;
submitMethod(doctaskid);
}
      });
  }

  
</script>

<body>
      <form action="/pretask2Submit.do" name="" id="">
         <table border="0" width="80%" height="200px;" bgcolor="white" align="center" id="mytable">
            <tr style="border: 1;font-weight: bold;" >
               <th width="33%">选择</th>
               <th width="33%">displayname</th>
               <th width="33%">uncpath</th>
            </tr>
              <c:forEach var="t" items="${cmsListData}">
          <tr>
             <td width="33%">
                <input type="radio" name="radio"/>
             </td>
             <td width="33%" class="displayname">${t.displayname }</td>
             <td width="33%" class="uncpath">${t.uncpath }</td>
             <input type="hidden" value="${t.id }" class="id"/>
             <input type="hidden" value="${t.clipguid }" class="clipguid"/>
             <input type="hidden" value="${t.parentid }" class="parentid"/>
             <input type="hidden" value="${t.resourcetype }" class="resourcetype"/>
             <input type="hidden" value="${t.doctaskid }" class="doctaskid"/>
          </tr>
      </c:forEach> 
     <tr class="ss">
               <td colspan="8">
                 <input type="button" value="提交任务" onclick="javascript:pre2submit();">
               </td>
            </tr>
    
         </table>
      </form>
</body>

你可能感兴趣的:(jquery,jsp,json,css,ext)