怎样用JS在两个纯html页面之间传递多个字符串参数?
我有两个html页,2.htm嵌套在1.htm的iframe框架里,1.htm调用了2.htm中的一个function函数,打开1.htm时,2.htm能够接收到1.htm传来的六个字符串参数send1~send6。请高手指点如何实现,请附上完整的代码。谢谢!
我的主要涉及代码如下:
1.htm代码:
<script type="text/javascript">
window.onload = function() {
function iframechild(id) {
return document.getElementById(id);
}
iframechild('iframebox').innerHTML = '<iframe id="childpage" name="childpage" src="2.htm" width="1600" height="730"></iframe>';
}
function InfoQuery(){
window.frames["childpage"].connectDB();
var send1="字符串1";
var send2="字符串2";
var send3="字符串3";
var send4="字符串4";
var send5="字符串5";
var send6="字符串6";
}
</script>
</head>
<body>
<button onClick="InfoQuery()">Query</button>
<div id='iframebox'></div>
</body>
2.htm代码:
<script type="text/Javascript">
function connectDB()
{
try{
var count=0;
var conn=new ActiveXObject("ADODB.Connection");
var rs=new ActiveXObject("ADODB.Recordset");
var filePath = location.href.substring(0, location.href.indexOf("2.htm"));
var path = filePath + "SLMixing_Alarm.mdb";
var path=path.replace('file:///','');
var connectString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path;
var selectString="select * from UnionQuery";
var tableString="";
conn.open(connectString);
rs=conn.execute(selectString);
我的主要涉及代码如下:
1.htm代码:
<script type="text/javascript">
window.onload = function() {
function iframechild(id) {
return document.getElementById(id);
}
iframechild('iframebox').innerHTML = '<iframe id="childpage" name="childpage" src="2.htm" width="1600" height="730"></iframe>';
}
function InfoQuery(){
window.frames["childpage"].connectDB();
var send1="字符串1";
var send2="字符串2";
var send3="字符串3";
var send4="字符串4";
var send5="字符串5";
var send6="字符串6";
}
</script>
</head>
<body>
<button onClick="InfoQuery()">Query</button>
<div id='iframebox'></div>
</body>
2.htm代码:
<script type="text/Javascript">
function connectDB()
{
try{
var count=0;
var conn=new ActiveXObject("ADODB.Connection");
var rs=new ActiveXObject("ADODB.Recordset");
var filePath = location.href.substring(0, location.href.indexOf("2.htm"));
var path = filePath + "SLMixing_Alarm.mdb";
var path=path.replace('file:///','');
var connectString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path;
var selectString="select * from UnionQuery";
var tableString="";
conn.open(connectString);
rs=conn.execute(selectString);
...全文
相关推荐
纯html静态页传值.
纯前端html和html之间传值,获取,如 ”域名/id/1“在另一个html页面获取到该id的方法
页面跳转js获取传递的参数
页面跳转js获取传递的参数,多种类型供大侠们参考
详解前端在html页面之间传递参数的方法
主要介绍了详解前端在html页面之间传递参数的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
html页面跳转传递参数Demo
html页面跳转传递参数Demo
javascript实现html页面之间参数传递的四种方法实例分析
本文实例讲述了javascript实现html页面之间参数传递的四种方法。分享给大家供大家参考,具体如下: 我们知道,在服务器端asp,jsp等程序可以接受html页面上的form传来的参数。那么,可不可以传递参数给html页面呢。可以。 原理:通过[removed].href中的分割符获得各个参数 方法一: /* *函数功能:从href获得参数 *sHref: http://www.cscenter.com.cn/arg.htm?arg1=d&arg2=re *sArgName:arg1, arg2 *return: the value of arg. d, re *


