在ASP.NET页面中如何利用JAVASCRIPT脚本向IFRAMES和POPUP传值
来源:codeproject.com 发布时间:2007-09-23 13:18:00
标签:.net,iframe,popup
许多网页开发者想从ASP.NET 页面传递一个值到另一个页面(比如从一个框架frame页面到一个弹窗页面)。看了代码就明白了。呵呵。
(一)向IFRAME传值
// Client Script
function fnPostBackBetweenFrames(postBackFormString, frameName, actionUrl)
{
var postBackForm = eval(postBackFormString);
postBackForm.target = frameName;
postBackForm.action = actionUrl;
postBackForm.__VIEWSTATE.name = ’’;
postBackForm.method = "post";
postBackForm.submit();
return false;
} // Server Code
string bottomFunction = String.Concat("javascript:return fnPostBackBetweenFrames(’document.", formName, "’,’bottomFrame’,’BottomForm.aspx’);");
btnPostFrame.Attributes.Add("onclick", bottomFunction);
上面是通过定义FROM表单之后。直接SUBMIT提交表单到指定的页面去。然后在后台通过
protected void Page_Load(object sender, System.EventArgs e)
{
txaValues.Text = GetParamValue("txaContent");
}
protected string GetParamValue(string sKeys)
{
string request = String.Empty;
if(Request.Params[sKeys] != null && Request.Params[sKeys].ToString() != String.Empty)
{
request = Request.Params[sKeys].ToString();
}
return request;
}
就能得到另外一个页面IFRAME表单上的值
(二)弹出窗口赋值
// Client Script
function fnPostBackPopUp(postBackFormString, windowName, actionUrl, vWidth, vHeight)
{
var postBackForm = eval(postBackFormString);
var wForm = ViewCenterPop("about:blank", windowName, vWidth, vHeight, ’no’, ’no’, ’no’, ’no’, ’no’);
postBackForm.target = windowName;
postBackForm.action = actionUrl;
postBackForm.__VIEWSTATE.name = ’’;
postBackForm.method = "post";
postBackForm.submit();
wForm.focus();
return false;
} // Server Code
string popupFunction = String.Concat("javascript:return fnPostBackPopUp(’document.", formName, "’,’PopPostBackWindow’,’PopupPage.aspx’,300,300);");
btnPostPopup.Attributes.Add("onclick", popupFunction);
来源:http://www.codeproject.com/useritems/postwebformbetweenframes.asp
下载地址:postwebformbetweenframes.zip (15.62 KB)
0
投稿
猜你喜欢
- 我就废话不多说了,大家还是直接看代码吧~import tensorflow as tfn1 = tf.constant(2)n2 = tf.
- PyCharm2020 激活到 2100年一次激活,用到退休,就问你怕了没?超级硬核破解,从此不再找激活码,不再改HOST !!!!!Pyc
- 本文实例讲述了Python中文分词工具之结巴分词用法。分享给大家供大家参考,具体如下:结巴分词工具的安装及基本用法,前面的文章《Python
- 主要作用与拷贝文件用的。1.shutil.copyfileobj(文件1,文件2):将文件1的数据覆盖copy给文件2。import shu
- 本文实例讲述了JavaScript判断前缀、后缀是否是空格的方法。分享给大家供大家参考。具体如下:// Js 判断后缀 String.pro
- 我们在编写Python爬虫时,有时会遇到网站拒绝访问等反爬手段,比如这么我们想爬取蚂蚁短租数据,它则会提示“当前访问疑似黑客攻击,已被网站管
- mysql安装好经常发现无法正常启动碰到最多的是error 2003的错误,以下为解决方法: mysqld -nt -remove mysq
- 引言:Flask是Python社区非常流行的一个Web开发框架,本文将尝试将介绍APScheduler应用于Flask之中。1. Flask
- 为index.php文件设置只读属性后,木马就没权限给你文件末尾追加广告了。下面我们看具体的代码,设置index.php只读:<?ph
- 宝塔更新Python版本因为在宝塔中的Python版本为2.6.8,使用宝塔Python项目管理的话需要把Python升级到3.x,不然的话
- 本文详细讲述了python的内嵌time模块的用法。分享给大家供大家参考之用。具体分析如下: 一、简介time模块提供各种操作时
- 一个封装好的链接Oracle数据库的工具类,可以方便的获取Connection对象关闭Statement、ResultSet、Statmen
- 英文文档:class complex([real[, imag]])Return a complex number with the val
- 服务端:#!/usr/bin/envimport SocketServerclass myMonitorHandler(SocketServ
- 环境描述: 某公司装了一台SQL Server数据库,为了保证数据库能够在出现故障时及时的修复,管理员做了备份操作,比如说完整备份+差异备份
- 本文实例为大家分享了Vue实现通知或详情类弹窗的具体代码,供大家参考,具体内容如下效果如图所示:(整体样式模仿ant-design-vue
- Python编程时,经常需要跳过第一行读取文件内容。简单的做法是为每行设置一个line_num,然后判断line_num是否为1,如果不等于
- 前言Go 1.3 的sync包中加入一个新特性:Pool。这个类设计的目的是用来保存和复用临时对象,以减少内存分配,降低CG压力。type
- 前言Python中使用SSH需要用到OpenSSH,而OpenSSH依赖于paramiko模块,而paramiko模块又依赖于pycrypt
- 前言本文主要给大家介绍了关于Django跨域请求问题解决的几种方法,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。几种方法