如何使用Iframe实现本页提交?
发布时间:2010-06-05 12:36:00
如何使用Iframe实现本页提交?
例:
chunfeng.html
< html>
< head>
< title> asp之家教程之IFrame 本页提交 < /title>
< /head>
< !--DataSource is Data Binding control-->
< script>
function clickbutton(src)
{
if(src == 1)
{
document.all("div1").style.display = "";
document.all("div2").style.display = "none";
}
else
{
document.all("div1").style.display = "none";
document.all("div2").style.display = "";
}
}
function showdata()
{
Name.value = document.frames("framesubmit").document.all("submitform").Name.value;
Age.value = document.frames("framesubmit").document.all("submitform").Age.value;
description.innerText = document.frames("framesubmit").document.all("submitform").description.innerText;
editbutton.disabled = false; } function submit() { submitbutton.disabled = true;
editbutton.disabled = true; Name.disabled = true; Age.disabled = true;
description.disabled = true;
document.frames("framesubmit").document.all("submitform").Name.value = Name.value;
document.frames("framesubmit").document.all("submitform").Age.value = Age.value;
document.frames("framesubmit").document.all("submitform").description.innerText = description.innerText;
document.frames("framesubmit").document.all("submitform").action = "Frame.asp?POST=1"
document.frames("framesubmit").document.all("submitform").submit();
}
< /script>
< body>
< label style="cursor:hand;background-color:gray" onclick="clickbutton(1);">第一个动态页面< /label>
< label style="cursor:hand;background-color:silver" onclick="clickbutton(2);">第二个动态页面< /label>
< div id="div1" style="display:" >
< hr>
< table width=100%>
< tr>
< td width=30%>姓名</td>
< td width=30%>年龄</td>
< td width=100%> </td>
< /tr>
< tr>
< td>< input style="width:100%" id=Name disabled>< /td>
< td>< input style="width:100%" id=Age disabled></td>
< td>< input type="button" id="editbutton" value="编辑" onclick="Name.disabled = false; Age.disabled =
false; description.disabled = false; submitbutton.disabled=false;"></td>
< /tr>
< tr>
< td colspan="2">< textarea id=description style="width:100%;height=300" disabled>< /textarea>< /td>
< td valign="bottom">< input type="button" value="提交" onclick="submit()" disabled id="submitbutton">< /td>
< /tr>
< /table>
< /div>
< div id="div2" style="display:none" >
< input type=hidden id="btnResult" name="btnResult" onclick="showdata()">
< hr>
< table width=100%>
< tr>
< td width=30%>姓名</td>
< td width=30%>年龄</td>
< td width=100%></td>
< /tr>
< tr>
< /tr>
< /table>
< /div>
< iframe id="framesubmit" src="Frame.asp" style="display:none"> < /iframe>
< /body>
< /html>
frame.asp
< %@ Language=VBScript %>
< %
dim post, eFlag, Name, Age, Des, enter, szTemp
post = Request.QueryString("POST")
set d = server.createobject("scripting.filesystemobject")
if post < > "" then
d.DeleteFile "c:\intels\wwwroot\test\date.csv"
set write = d.Createtextfile("c:\intels\wwwroot\test\date.csv")
szTemp = Request.Form ("Name")
write.WriteLine(szTemp)
szTemp = Request.Form ("Age")
write.WriteLine(szTemp)
szTemp = Request.Form ("description")
write.WriteLine(szTemp)
write.Close
end if
set file = d.opentextfile("c:\intels\wwwroot\test\date.csv")
Name = file.ReadLine
Age = file.ReadLine
enter = chr(10)
%>
< HTML>
< HEAD>
< script for="window" event="onload" language="JavaScript">
parent.frames.document.all.btnResult.click();
< /script>
' 这三行是Iframe和其父窗口进行通信息的关键,在ASP处理完数据之后,向父窗口报告数据提交过程已结束.如果还想在第二个动态页面中加入同样的效果,可在选中第二个动态页面时改变Iframe的src,调入与它相对应的数据.
< /HEAD>
< BODY>
< form style="display:"
name="submitform"
method="post">
< input id="Name" name="Name" value="< %=Name%>">
< input id="Age" name="Age" value="< %=Age%>">
< Textarea id="description" name="description" value=""> < %while not file.AtEndOfStream
Response.write (file.ReadLine)
Response.write enter
wend%>
< /textarea>
< /form>
< %file.Close%>
< /BODY>
< /HTML>
date.csv
Victor
23
Song Yan-hao
Li Yan-bing
Fei Wen-hua
Wu Xiao-tao
猜你喜欢
- 我的测试环境是2000sever ie6.0+sp4 MYIE1.31 (成功通过测试)关闭窗口的途径常用4种:1.双击左上角图标2.直接双
- 在我们开始一个项目的设计的时候,脑子里肯定有无数的构想。是做视觉冲击强烈、夺人眼球的绚丽风格?还是复古的拼贴风?又或者目前最in的极简主义设
- 什么是数据库镜像?Robidoux:数据库镜像是将数据库事务处理从一个SQL Server数据库移动到不同SQL Server环境中的另一个
- 方法一 :这个是我在站长工具的查询页面使用的防止频繁查询,刷新页面的代码!下面函数的功能是3秒内查询页面即刷新了页面,超过2次就提示!sea
- 1.intersect为取多个查询结果的交集;2.查询两个基本时间段内表记录的SQL语句;select * from shengjibiao
- 一般现今ASP木马常通过以下四点来操作服务器,所以我们只要将一下四处设置好就能从一 前使用IIS服务器的站长很多,特别是对于ASP网站来说,
- 1. ORACLE 的解析器按照从右到左的顺序处理 FROM 子句中的表名,因此 FROM 子句中写在最后的表(基础表 driving ta
- 如何实现让每句话的头一个字母都大写? <%dim txtFnametxtFName = &qu
- ISNULL 使用指定的替换值替换 NULL。 &nb
- 是否曾经有过这样的经历:把一个元素置于另一个元素之上,而希望下面的那个元素成为可点击的?现在,利用css的pointer-events属性即
- 如果你有一字段dm记录了一个url,为了更好的优化模糊查询速度或统计速度,在数据表原有的结构上增加3个字段,分别为 `sdm`
- asp三天学好ADO对象之第一天 今天说一下Recordset 对象的属性1、CursorType 属性AdOpenForwardOnly:
- ASP使用xmlhttp获取远程网页内容,解决乱码问题方法一:<%function getHTTPPage(url)on error
- HTML5 是近十年来 Web 标准最巨大的飞跃。和以前的版本不同,HTML 5 并非仅仅用来表示 Web 内容,它的使命是将 W
- 很多人对于CSS都是边干边学习,因为它不像C#之类的语言那么复杂,看起来似乎挺简单,然而正是这种对CSS的不完整的理解,导致了许多的CSS代
- 如果需要在查询语句返回的列中包含一列表示该条记录在整个结果集中的行号, ISO SQL:2003 标准提出的方法是提供 ROW_NUMBER
- 从毕业实习算起,从事可用性方面的工作到现在已经5年了。在此记录笔者的一些所见所想,和大家讨论分享一下。用户研究在“以用户为中心”的界面设计方
- 1:在终端下:mysql -V。 以下是代码片段:[shengting@login ~]$ mysql -Vmysql Ver 14.7 D
- 一个网站程序,在添加新闻时出现错误以下是错误提示: Microsoft OLE DB Provide
- 求英文字母、数字、下划线、汉字的js正则表达式英文字母或数字或下划线,英文字母数字下划线是:/^\w+$/汉字的是:/^[\u0391-\u