我有一個數據一個彈出式窗口中從數據庫中的表,我能夠將值從彈出轉移到父窗口是這樣的:傳輸相關值的Javascript
彈出數據:
<%
for (int i = 0; i < size; i++) {
ArrayList one = (ArrayList) all.get(i);
%>
<tr style="height:30px; padding:4px;">
<td><div align="center"><a href="" onclick="getBranchValue(this)" id="cname"><%=(String) one.get(0)%></a></div></td>
<td><div align="center"><%=(String) one.get(1)%></div></td>
<td><div align="center"><%=(String) one.get(2)%></div></td>
</tr>
<% }%>
getBranchValue的javascript:
function getBranchValue(ths) {
if (window.opener !== null && !window.opener.closed) {
var func = window.opener.document.getElementById("solid");
func.value = ths.innerHTML; //for innerhtml
window.close();
}
}
我需要也第二陣列中傳遞數據到這樣我已經通過表修改到父窗口:
<a href="" onclick="getBranchValue(this,<%=(String) one.get(1)%>)" id="cname">
,我的功能:
function getBranchValue(ths, soldesc) {
if (window.opener !== null && !window.opener.closed) {
var func = window.opener.document.getElementById("solid");
var desc = window.opener.document.getElementById("branchname");
func.value = ths.innerHTML; //for innerhtml
desc.value = soldesc;
window.close();
}
}
但在點擊它只是掛在那裏。我該怎麼辦?
在瀏覽器控制檯任何JavaScript錯誤? –