取得对象值的方式一:
<input id="proxyType" type="hidden" name="useType" value="<s:property value='useType'/>"/>
if(document.getElementById(
"proxyType"
).value == 'N')return;
同时给对象赋值:
document.getElementById(
'isNeedLedger'
+thisId).value =
"false"
;
取得对象值的方式二:
var
ledgerUserName = document.getElementsByName(
"ledgerUserName"
);
ledgerUserName[i].value
jQuery取值:
$(
'#payChannelId'
+arr[j].payCode).val();
隐藏和显示:
在动态页面时thisId可以动态标识唯一一个id.这样取值时能取到动态生成的唯一的ID.
var thisId = 'aaa';
$(
'#ledgerSelectTD'
+thisId).show();
$(
'#ledgerSelectTD'
+thisId).hide();
JSP页面为:
<table class="table1" cellpadding="2" cellspacing="0">
<s:iterator value="payChannelWList">
<tr>
<th>
<s:checkbox id="payChannelIdc%{payCode}" name="payChannelId" value="false"
οnclick="payChannelIdClick('%{payCode}',this.checked);"></s:checkbox>
</th>
<td>
<s:property value="payChannelName"></s:property>
<s:hidden id="payChannelId%{payCode}" value="%{payChannelId}"></s:hidden>
<s:hidden id="payChannelName%{payCode}" value="%{payChannelName}"></s:hidden>
<s:hidden id="payType%{payCode}" value="%{payType}"></s:hidden>
<s:hidden id="ifLedger%{payCode}" value="%{ifLedger}"></s:hidden>
</td>
<th>
<s:checkbox id="proxyServiceType%{payCode}"
name="proxyServiceType" value="true"
οnclick="proxyServiceTypeClick('%{payCode}',this.checked);"></s:checkbox>
</th>
<td>
<s:label>是否代收</s:label>
</td>
<th id="payChannelIdTH<s:property value='payCode'/>"
style="display:none;">
<s:label>合作ID:</s:label>
</th>
<td id="payChannelIdTD<s:property value='payCode'/>"
style="display:none;">
<s:textfield id="partnerId%{payCode}" name="partnerId"></s:textfield>
</td>
<th id="payChannelKeyTH<s:property value='payCode'/>"
style="display:none;">
<s:label>密钥:</s:label>
</th>
<td id="payChannelKeyTD<s:property value='payCode'/>"
style="display:none;">
<s:password id="partnerKey%{payCode}" name="partnerKey"></s:password>
</td>
添加一行:
//添加一行
function
add()
{
var
tledgerbody = document.getElementById(
"tledgerbody"
);
var
rowNo = tledgerbody.rows.length;
tledgerbody.insertRow(rowNo);
tledgerbody.rows[rowNo].insertCell(0);
tledgerbody.rows[rowNo].cells[0].innerHTML =
"<input name='ledgerUserName' type='text'></input>"
;
tledgerbody.rows[rowNo].insertCell(1);
tledgerbody.rows[rowNo].cells[1].innerHTML =
"<input name='ledgerAccount' type='text'></input>"
;
tledgerbody.rows[rowNo].insertCell(2);
tledgerbody.rows[rowNo].cells[2].innerHTML =
"<input name='ledgerRule' type='text'></input>%"
;
tledgerbody.rows[rowNo].insertCell(3);
tledgerbody.rows[rowNo].cells[3].innerHTML =
"<input type='button' value='删除' οnclick='deleteRow(event)'/>"
;
}
<td><span style="color: red">*</span></td>
textarea:
<
textarea
rows
=
"5"
cols
=
"40"
id
=
"question"
name
=
"customerService.question"
></
textarea
>