网页编程中的模态对话框
来源:互联网 发布:华为网络通信设备介绍 编辑:程序博客网 时间:2024/05/20 09:25
调用代码如下:
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function showChose() {
//以弹出窗口的形式 弹出头像选择窗口 并接受返回值
var src = window.showModalDialog("Face.aspx", "", "width:480px;height:480px;menu:no;tool:no;status:no;");
//将返回的图片 显示出来
document.getElementById("imgFace").src = src;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<!--用户单击此层 弹出头像选择窗口 -->
<span style="color:Red;cursor:hand;" onclick="showChose()">选择头像</span>
<img id="imgFace" />
</div>
</form>
</body>
</html>
被调用页面代码如下:
face.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Face.aspx.cs" Inherits="Face" %>
<%@ Import Namespace="System.IO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
//当用户单击头像图片时 执行的JavaScript脚本
function returnFace(src) {
//关闭当前窗体 并返回用户选择的头像的URL
window.opener = "";
window.returnValue = src;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<%
//获取头像文件夹
DirectoryInfo dic = new DirectoryInfo(this.Server.MapPath("Faces"));
int i = 0;
//循环遍历头像文件
foreach (FileInfo f in dic.GetFiles())
{
if (f.Extension == ".bmp")
{
%>
<!---生成头像显示图片框--->
<img src='<%=@"faces/"+f.Name %>' onclick="returnFace(this.src);" />
<%
i++;
//每显示10章图片 即换行
if (i % 10 == 0)
{
Response.Write("<br/>");
}
continue;
}
}
%>
</div>
</form>
</body>
</html>
当不考虑效率时,或工期比较紧时,可考虑用这种方法。
- 网页编程中的模态对话框
- 创建模态网页对话框
- JS模态对话框弹出(对话框嵌入网页)
- javascript网页对话框,模态窗口(showModalDialog)
- 单击网页中的按钮,弹出对话框
- Qt4中的模态对话框与非模态对话框用法总结
- MFC中的模态对话框和非模态对话框
- MFC中的模态对话框和非模态对话框
- c#中的模态对话框和非模态对话框
- MFC中的模态对话框与非模态对话框
- css javascript div实现网页的模态对话框
- 网页对话框
- 网页对话框
- 网页对话框
- 网页对话框
- 网页对话框
- asp.net中的模态对话框
- asp.net中的模态对话框
- 隐私保护利器-----开辟密盘
- Ubuntu 9.10 构建Linux内核树
- C语言中不同数据类型间混合运算的转换规则
- hdu 1715 大菲波数(Easy)
- 不良代码展示-不要用数组循环判断等于的方式,来判断一个对象是否在一个集合内
- 网页编程中的模态对话框
- hdu 1720 A+B Coming(Easy)
- 第1章 寻找入口
- 语言的编程能力
- 对程序员职业规划的一些看法
- 架构师之我见
- 旋转卡壳--凸包之间的最大距离
- c++面向对象编程必备“良方”(欢迎大家来补充!)
- Windows Socket五种I/O模型——代码全攻略