如何用请求字符串传值给用模式窗口打开的aspx页面。
2005-03-25 11:37
666 查看
模式窗口是一种方便的当前页面扩展的方式,但是aspx文件只能作为HTM文件的IFRAME才能用这种方式调用。同时,请求字符串也是一种方便常用的页面间传值的方法,那么怎么样使两者给合起来,就是实现如何用请求字符串传值给用模式窗口打开的aspx页面呢?
我们可以用JS脚本实现这种功能:
1.调用页面代码:
<script language="javascript">
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
</script>
2.打开的HTM文件的代码(SearchItemC.htm):
function ResolveUrl()
{
var frm = window.frames[0];
frm.location = location.toString().replace("C.htm","C.aspx");
}
<HTML>
<HEAD>
<script language="javascript">
function ResolveUrl()
{
var frm = window.frames[0];
frm.location = location.toString().replace("C.htm","C.aspx");
}
</script>
</HEAD>
<BODY style="margintop:0;marginleft:0;marginright:0;marginbottom:0" onload="ResolveUrl()">
<table align="left" cellpadding="0" cellspacing="0" width="100%" height="100%" ID="Table1">
<tr>
<td valign="top" width="100%" height="100%"><iframe id="ifmain" border="0" width="100%" height="100%"></iframe></td>
</tr>
</table>
</BODY>
</HTML>
3.Aspx文件(SearchItemC.aspx)代码:
Request.QueryString["sysid"].Trim();
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
我们可以用JS脚本实现这种功能:
1.调用页面代码:
<script language="javascript">
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
</script>
2.打开的HTM文件的代码(SearchItemC.htm):
function ResolveUrl()
{
var frm = window.frames[0];
frm.location = location.toString().replace("C.htm","C.aspx");
}
<HTML>
<HEAD>
<script language="javascript">
function ResolveUrl()
{
var frm = window.frames[0];
frm.location = location.toString().replace("C.htm","C.aspx");
}
</script>
</HEAD>
<BODY style="margintop:0;marginleft:0;marginright:0;marginbottom:0" onload="ResolveUrl()">
<table align="left" cellpadding="0" cellspacing="0" width="100%" height="100%" ID="Table1">
<tr>
<td valign="top" width="100%" height="100%"><iframe id="ifmain" border="0" width="100%" height="100%"></iframe></td>
</tr>
</table>
</BODY>
</HTML>
3.Aspx文件(SearchItemC.aspx)代码:
Request.QueryString["sysid"].Trim();
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
function GetCorrelativeItemId()
{
rdl = document.getElementsByName("rdlSystem");
input = document.getElementById("txtCorrelativeItem");
sysid = "";
for(i = 0 ; i < rdl.length ; i++)
{
if(rdl[i].tagName == "INPUT")
{
if(rdl[i].checked)
{
sysid = rdl[i].value;
}
}
}
arg = window.showModalDialog("SearchItemC.htm?sysid="+sysid,window,"resizable:1;");
if(arg!=null)
{
input.value = arg;
}
}
相关文章推荐
- 如何用请求字符串传值给用模式窗口打开的aspx页面
- 如何让页面中所有的链接都在新窗口打开
- 如何让ShowDialogModel模式打开页面不记录cache,
- 如何强制360浏览器以极速模式打开页面(lofter博客转移飞碟)
- 如何在Flash中新窗口打开页面而不被拦截
- 模态窗口提交请求时禁止在新窗口打开页面的处理方法
- showmodaldialog模式窗口提交打开新页面的解决办法
- ASP.NET学习笔记[7] - aspx页面打开一个新窗体无刷新传值
- 如何使用 base 标签使页面中的所有标签在新窗口中打开
- javascript模式窗口中如何获取和设置父页面中控件
- EAS BOS中如何以模式窗口打开新界面。
- C#-WinForm-★★★★★跨窗体 构造函数传值 及应用—登录式窗口传值、如何关闭主页面时关闭应用程序、如何打开唯一窗口★★★★★
- 用模式窗口, 在主页面和子页面中互相传值
- 打开模式窗,在父子页面传值
- 以模式窗口打开的页面回传时候要注意的地方
- .net中使用showModalDialog打开模式窗口,在后台代码中使用Response.Write()会弹出新页面
- 办公系统的学习(手动调用在线人数减一;两个打开页面如何传值,等)
- 以模式窗口打开的页面回传时候要注意的地方
- easyui jsp主页面打开子页面中dialog,如何给子页面dialog传值
- 关于如何在.aspx页面用javaScript实现点按钮弹出确认提示窗口