我用静态页面时模式对话框的样子好好的!可我放到asp.net里(dialog参数最后改成以.aspx结尾)出来的效果怎么变了?又有地址栏又有状态栏?
下面是代码:
test.htm<input type="button" value="打开对话框" onclick="showDialog()" />
<script>
function showDialog()
{
var retVal = showModalDialog('InputDialog.htm', '请输入您要重新设定的排序级别:', 'window.title:输入数字;dialogWidth:320px;dialogHeight:50px;status:0;');
if(retVal)
{
alert(retVal);
}
}
</script>
InputDialog.htm<html>
<title>输入对话框</title>
<body style="font-size:13px">
<div id="dialogTitle" style="margin-left:8px;margin-top:15px;"></div>
<script>
if(window.dialogArguments)
document.getElementById('dialogTitle').innerHTML=window.dialogArguments;
</script>
<div style="margin-left:8px;margin-top:25px;">
<input id="inputText" style="width:200px" />
<input type="button" value="确定" onclick="returnValue=document.getElementById('inputText').value;window.close();" />
<input type="button" value="取消" onclick="returnValue=false;window.close();" />
</div>
</body>
</html>最后Input.aspx
[code=C#]
<%@ Page Language="C#" %><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>输入对话框</title>
</head>
<body style="font-size: 13px">
<div id="dialogTitle" style="margin-left:8px;margin-top:15px;"></div> <script>
if(window.dialogArguments)
document.getElementById('dialogTitle').innerHTML = window.dialogArguments;
</script> <div style="margin-left: 8px; margin-top: 25px;">
<input id="inputText" style="width: 200px" />
<input type="button" value="确定" onclick="checkOnReturn()" />
<input type="button" value="取消" onclick="window.returnValue=false;window.close();" />
</div>
<script type="text/javascript">
function checkOnReturn()
{
var inputNumber = document.getElementById('inputText').value;
if(inputNumber == '')
{
window.returnValue = false;
window.close();
}
var regx = /^\d+$/;
if(regx.test(inputNumber))
{
window.returnValue = inputNumber;
window.close();
}
else
{
alert('您输入不的是有效的数字');
}
}
</script>
</body>
</html>[/code]
下面是代码:
test.htm<input type="button" value="打开对话框" onclick="showDialog()" />
<script>
function showDialog()
{
var retVal = showModalDialog('InputDialog.htm', '请输入您要重新设定的排序级别:', 'window.title:输入数字;dialogWidth:320px;dialogHeight:50px;status:0;');
if(retVal)
{
alert(retVal);
}
}
</script>
InputDialog.htm<html>
<title>输入对话框</title>
<body style="font-size:13px">
<div id="dialogTitle" style="margin-left:8px;margin-top:15px;"></div>
<script>
if(window.dialogArguments)
document.getElementById('dialogTitle').innerHTML=window.dialogArguments;
</script>
<div style="margin-left:8px;margin-top:25px;">
<input id="inputText" style="width:200px" />
<input type="button" value="确定" onclick="returnValue=document.getElementById('inputText').value;window.close();" />
<input type="button" value="取消" onclick="returnValue=false;window.close();" />
</div>
</body>
</html>最后Input.aspx
[code=C#]
<%@ Page Language="C#" %><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>输入对话框</title>
</head>
<body style="font-size: 13px">
<div id="dialogTitle" style="margin-left:8px;margin-top:15px;"></div> <script>
if(window.dialogArguments)
document.getElementById('dialogTitle').innerHTML = window.dialogArguments;
</script> <div style="margin-left: 8px; margin-top: 25px;">
<input id="inputText" style="width: 200px" />
<input type="button" value="确定" onclick="checkOnReturn()" />
<input type="button" value="取消" onclick="window.returnValue=false;window.close();" />
</div>
<script type="text/javascript">
function checkOnReturn()
{
var inputNumber = document.getElementById('inputText').value;
if(inputNumber == '')
{
window.returnValue = false;
window.close();
}
var regx = /^\d+$/;
if(regx.test(inputNumber))
{
window.returnValue = inputNumber;
window.close();
}
else
{
alert('您输入不的是有效的数字');
}
}
</script>
</body>
</html>[/code]
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货