js代码收录

                <td>自定义字段</td>
   <td colspan="3">
     <select name="" id="list" onchange="javascript:checkMark(this)">
        <option value="-1"></option>
        <s:iterator value="sortedCustomerMarkFields">
              <s:if test="ordinal==0">
              <s:if test="visible"> 
               <option value="0"><s:property value='name' /></option>
             </s:if>
             </s:if>
             <s:if test="ordinal==1">
              <s:if test="visible">
               <option value="1"><s:property value='name' /></option>
             </s:if>
             </s:if>
             <s:if test="ordinal==2">
              <s:if test="visible">
               <option value="2"><s:property value='name' /></option>
             </s:if>
             </s:if>
             <s:if test="ordinal==3">
              <s:if test="visible">
               <option value="3"><s:property value='name' /></option>
             </s:if>
             </s:if>
        </s:iterator>
     </select>
              <td><input type="text" name="" id="fields" class="hidden"/></td>//使用隐函数表单的提交方式,个人觉得这样肤质很不错.
     //定义传参数的方式---

function checkMark(obj)

                                {
                                  var mark=$(obj).val();
                                  var inputObj=$("#fields");
                                  if(mark!=-1)
                                  {
                                      inputObj.removeAttr("class");
                                      if(mark==0)
                                      {
                                          inputObj.attr("name","bean.customerName");
                                      }
                                      if(mark==1)
                                      {
                                          inputObj.attr("name","bean.customerAddress");
                                      }
                                      if(mark==2)
                                      {
                                          inputObj.attr("name","bean.contactName");
                                      }
                                      if(mark==3)
                                      {
                                          inputObj.attr("name","bean.contactPhone");
                                      }
                                  }else{
                                      inputObj.attr("class","hidden");
                                      inputObj.attr("name","");
                                  }
                                }
                        </script>

你可能感兴趣的:(js代码收录)