建立:兩個Button:「是」,「否」
程式碼:
protected void btn_Y_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "select", string.Format("returnValue='{0}';window.close();", "Yes"), true);
}
protected void btn_N_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "select", string.Format("returnValue='{0}';window.close();", "No"), true);
}
呼叫的頁面
.aspx
javascript
function doIsSave()
{
var url = 'Messagebox.aspx';
var retValue = window.showModalDialog(url, '提示', 'resizable:no;scroll:no;status:no;dialogHeight=80pt;dialogWidth=300pt');
if(retValue != null && retValue !="")
{ //alert(retValue);
document.getElementById("h_issave").value=retValue;
}
}
程式碼:
protected void btn_Y_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "select", string.Format("returnValue='{0}';window.close();", "Yes"), true);
}
protected void btn_N_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(this.GetType(), "select", string.Format("returnValue='{0}';window.close();", "No"), true);
}
呼叫的頁面
.aspx
javascript
function doIsSave()
{
var url = 'Messagebox.aspx';
var retValue = window.showModalDialog(url, '提示', 'resizable:no;scroll:no;status:no;dialogHeight=80pt;dialogWidth=300pt');
if(retValue != null && retValue !="")
{ //alert(retValue);
document.getElementById("h_issave").value=retValue;
}
}
.cs
page_Load:Button.Attributes.Add("OnClick", "javascript:doIsSave();");
protected void Button_Click(object sender, EventArgs e)
{
if (h_issave.Value == "Yes")
if (h_issave.Value == "No")
}
沒有留言:
張貼留言