我使用简单的javascript在asp.net中打开一个对话框
<script type="text/javascript" language="javascript" >
function openDialog() {
var result = window.showModalDialog("", "", "dialogWidth:300px; dialogHeight:201px; center:yes");
}
</script>
并使用它
但是收到错误消息 错误5'ASP.default_aspx'不包含'openDialog'的定义,并且没有扩展方法'openDialog'可以找到接受类型'ASP.default_aspx'的第一个参数(你是否缺少using指令或程序集引用?)
答案 0 :(得分:0)
试试这个
<script>
function ShowDialog()
{
//declare a string variable
var retval="";
//show modal dialog box and collect its return value
retval=window.showModalDialog
('dialogboxhostframe.htm',window);
//check if user closed the dialog
//without selecting any value
if(retval!="" && retval!=null)
{
//fill the textbox with selected value
document.getElementById("TextBox1").value=retval;
}
}
</script>