var retVal=window.showModalDialog(... if(retVal == "refresh ");//刷新 子 window.returnValue="refresh"; window.close();
var ret = showmodaldialog(url....); return false;//或根据ret的返回值决定是return true还是return false,如果是return true,则表示执行完客户端动作以后再执行postback的动作。
function showBoads() { var a = window.showModalDialog("/Admin/product/SelectProduct.aspx", "", "dialogWidth=672px;dialogHeight=368px;status=no;help=no;scrollbars=no");
if (a != null && a != "undefined") { var cid = a.substr(a.indexOf('/') + 1); document.getElementById("<%=txtCid.ClientID %>").value = cid; document.getElementById("<%=txtresult.ClientID %>").value = a.substr(0, a.length - 1 - cid.length); } else { document.getElementById("<%=txtresult.ClientID %>").value = ""; } }
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SelectProduct.ascx.cs" Inherits="Patti.Web.Controls.SelectProduct" %> <script type="text/javascript"> function showBoads() { var a = window.showModalDialog("/Admin/product/SelectProduct.aspx", "", "dialogWidth=800px;dialogHeight=368px;status=no;help=no;scrollbars=no");
if(retVal == "refresh ");//刷新
子
window.returnValue="refresh";
window.close();
return false;//或根据ret的返回值决定是return true还是return false,如果是return true,则表示执行完客户端动作以后再执行postback的动作。
var a = window.showModalDialog("/Admin/product/SelectProduct.aspx", "", "dialogWidth=672px;dialogHeight=368px;status=no;help=no;scrollbars=no");
if (a != null && a != "undefined") {
var cid = a.substr(a.indexOf('/') + 1);
document.getElementById("<%=txtCid.ClientID %>").value = cid;
document.getElementById("<%=txtresult.ClientID %>").value = a.substr(0, a.length - 1 - cid.length);
}
else {
document.getElementById("<%=txtresult.ClientID %>").value = "";
}
}
return false 表示不刷新把?
但是我加了没用`
<script type="text/javascript">
function showBoads() {
var a = window.showModalDialog("/Admin/product/SelectProduct.aspx", "", "dialogWidth=800px;dialogHeight=368px;status=no;help=no;scrollbars=no");
if (a != null && a != "undefined") {
var cid = a.substr(a.indexOf('/') + 1);
document.getElementById("<%=txtCid.ClientID %>").value = cid;
document.getElementById("<%=txtresult.ClientID %>").value = a.substr(0, a.length - 1 - cid.length);
}
else {
document.getElementById("<%=txtresult.ClientID %>").value = "";
}
return true;
}
</script>
<asp:TextBox ID="txtresult" runat="server"></asp:TextBox>
<asp:HiddenField ID="txtCid" runat="server" />
<input type="image" name="name" value=" " onclick="javascript:showBoads()"
src="/Admin/skin/images/selectTeacher.gif" />