[原创]打造最强悍的网页版仿真对话框窗口
打造最强悍的网页版仿真对话框窗口
能用来制作仿真对话框窗口的方法有很多,比如,在DW用表格模仿,用Dhtml,用hta(html应用程序)等等,在这里笔者用的是Dhtml+asp制作的,下面进行详细的介绍:
目标:制作一个类似于VB中的对话框窗口,要vbSystemModal级别的(即系统模式:在用户响应消息框前,所有应用程序都被挂起。)
用料:Dhtml函数一个:<<<<showModalDialog语法>>>>
variant=object.showModalDialog(sURL[,vArguments[,sFeatures]])参数描述:
sURL:指定要装载和显示的文件的URL地址
vArguments:可选.Variant变量在显示文件时设定的参数.这个参数可以传送包括数组在内的数据对话框通过访问window对象的dialogArguments属性,来获得这些属性。(即:可以向ASP发送参数)
sFeatures
可选。指定对话框窗体的参数,可有下列内容。
dialogHeight:iHeight设置对话框窗口的高度。
dialogWidth:iWidth设置对话框窗口的宽度。
dialogLeft:iXPos设置对话框窗口相对于桌面左上角的left位置。
dialogTop:iYPos设置对话框窗口相对于桌面左上角的top位置。
center:{yes|no|1|0}指定是否将对话框在桌面上居中,默认值是“yes”
help:{yes|no|1|0}指定对话框窗口中是否显示帮助图标,默认值是“yes”resizable:{yes|no|1|0}指定是否对话框窗口大小可变,默认值是“no”。
status:{yes|no|1|0}指定对话框窗口是否显示状态栏。对于非模式对话框窗口,默认值是“yes”,对于模式对话框窗口,默认值是“no”
下面请看调用网页的源代码:start.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
</head>
<script langauge="javascript">
function showmsg(title,msg,type)
{
var temp;
temp=showModalDialog(
"msg.asp?title="+title+"&msg="+msg+"&type="+type,
"","dialogWidth:15;dialogHeight:8;center:1")
return 0
}
</script>
<body>
<form >
<input type="button" value="test" name="cmd1" language="javascript"
onclick="alert(showmsg('title','message is here',2))">
</form>
</body>
</html>
下面是处理脚本的源代码:msg.asp
<%@ LANGUAGE="VBSCRIPT" %>
<%
dim title,msg,itype
title=request("title")
msg=request("msg")
itype=request("type")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=title%></title>
</head>
<body onload="window.returnValue=0" topmargin="0" leftmargin="0" bgcolor="#D6D3CE" text="#000000">
<table border="0" cellpadding="0" width="100%" cellspacing="0">
<tr>
<td width="100%"><p align="center"><br>
<img src="info.png" width="32" height="32" hspace="15" align="left"><%=msg%><br>
<br>
<%if itype=0 then
response.write "<input type='button' value='确 定' name='cmdOk' onclick='window.returnValue=1;window.close()'>"
elseif itype=1 then
response.write "<input type='button' value='确 定' name='cmdOk' onclick='window.returnValue=1;window.close()'>"
response.write "<input type='button' value='取消' name='cmdCANCEL' onclick='window.returnValue=0;window.close()'>"
elseif itype=2 then
response.write "<input type='button' value=' 是 ' name='cmdYes' onclick='window.returnValue=1;window.close()'>"
response.write "<input type='button' value=' 否 ' name='cmdNo' onclick='window.returnValue=0;window.close()'>"
end if%>
</td>
</tr>
</table>
</body>
</html>
结果是这样的
让我们在start.htm中在后面加上:status=no;help=no
结果把title换成空格(很多)试试。
搜索更多相关主题的帖子:
对话框窗口 网页版 仿真 Dhtml 应用程序 对话框 网页 仿真 窗口 原创
希望和电脑高手,ASP.NET高手,英语高手以及法律界的网友交好朋友^_^
<<<更多详情请看:http://ghtt.net/ghtt/dispuser.asp?id=1139