我在页面上有几个文本框,其值从返回值中填充 像这样的模态窗口,我有一个javascript方法,以下面的方式调用按钮的事件处理程序。值正在正确返回,文本框正在填充,但我得到的异常参数计数不匹配。
res = window.showModalDialog('frm_VisitorSearchPopUp.aspx', "", "dialogWidth:1024px;dialogHeight:600px");
getElementById('<%=AddVisitorID.ClientID %>').click();
当我使用window.open()方法时,这个问题不会发生,任何人都可以告诉我为什么会出现这个问题。 我的代码
function openup() {
var left = screen.width / 2 - 1024 / 2;
var tops = screen.height / 2 - 600 / 2;
var d = new Date();
var res;
res = window.showModalDialog('frm_VisitorSearchPopUp.aspx', "", "dialogWidth:1024px;dialogHeight:600px");
setvalues(res.PersonName, res.Address, res.CompanyName, res.ContactNumber, res.Email);
}
function setvalues(PersonName, Address, CompanyName, ContactNumber, Email) {
var RowId = $("#<%= VisitorDetailsGrid.ClientID%>").getDataIDs();
for (i = 0; i < RowId.length; i++) {
rowData = $("#<%= VisitorDetailsGrid.ClientID%>").getRowData(RowId[i]);
if (rowData.PersonName == PersonName && rowData.ContactNumber == ContactNumber && rowData.CompanyName == CompanyName && rowData.Email == Email && rowData.Address == Address) {
alert("The visitor \"" + PersonName + "\" has already been added to the visitor's list.");
document.getElementById('<%=PersonNameID.ClientID%>').value = "";
document.getElementById('<%=AddressID.ClientID%>').value = "";
document.getElementById('<%=CompanyNameID.ClientID%>').value = "";
document.getElementById('<%=ContactNumberID.ClientID%>').value = "";
document.getElementById('<%=EmailID.ClientID%>').value = "";
return;
}
}
document.getElementById('<%=PersonNameID.ClientID%>').value = PersonName;
document.getElementById('<%=AddressID.ClientID%>').value = Address;
document.getElementById('<%=CompanyNameID.ClientID%>').value = CompanyName;
document.getElementById('<%=ContactNumberID.ClientID%>').value = ContactNumber;
document.getElementById('<%=EmailID.ClientID%>').value = Email;
elem = document.getElementById('<%=AddVisitorID.ClientID %>').click();
}