<script language="VBScript"> function yesnocancel()
dim yorn yorn = msgbox("是否?",vbYesNoCancel,"提示") if yorn = vbYes then document.all.hidYorn.value = "是" msgbox document.all.hidYorn.value else if yorn = vbNo Then document.all.hidYorn.value = "否" msgbox document.all.hidYorn.value else document.all.hidYorn.value = "取消" msgbox document.all.hidYorn.value end if end if frmAbc.submit() end function </script> <body onload="yesnocancel()"> <form action="abc.aspx" name="frmAbc"> <input type=hidden value="" name="hidYorn"> </form> </body>
function getModelDialog()
{
var url = "";
url = "destination_page_url";
var returnData = showModalDialog(url,0,"dialogWidth:230px;dialogHeight:210px;resizable:no;scroll:no;status:no;help:no");
doWithReturnValue(returnData);
}
在对话框页面里写脚本时用returnValue传递返回值:
function doReturn()
{
// 构造返回值
var ret;
// build ReturnValue here...
returnValue = ret;
// 关闭,返回
window.close();
}
更多关于showModalDialog的知识请参考:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp
在后端就可以用 Request["hidXXX"]得到其值了。
function yesnocancel()
dim yorn
yorn = msgbox("是否?",vbYesNoCancel,"提示")
if yorn = vbYes then
document.all.hidYorn.value = "是"
msgbox document.all.hidYorn.value
else
if yorn = vbNo Then
document.all.hidYorn.value = "否"
msgbox document.all.hidYorn.value
else
document.all.hidYorn.value = "取消"
msgbox document.all.hidYorn.value
end if
end if
frmAbc.submit()
end function
</script>
<body onload="yesnocancel()">
<form action="abc.aspx" name="frmAbc">
<input type=hidden value="" name="hidYorn">
</form>
</body>
随便的一个函数名,代表你对返回值的处理,你可以做任何处理>> returnValue = ret;返回的值能在C#代码中使用不?
这些都是Javascript代码
返回的值你只要传到一个隐藏域里面<input type=hidden>或者直接提交到一个后台页
用Request对象返回该值,都行。