当前位置:首页 > 两个独立静态htm页面间如何传值

两个独立静态htm页面间如何传值

点击次数:1350  更新日期:2011-01-05
\n

下面是个例子:


\n

第一个页面: a.html


\n

<html>
<head>
</head>
<body>
<script language=”javascript” type=”text/javascript”>
function Open()
{
window.open(‘b.html’);
}
</script>
<form>
<input type=”text” id=”tbValue”><a href=”#” onclick=”Open()”>Open http://www.dwww.cn </a>
</form>
</body>
</html>


\n

第二个页面: b.html


\n

<html>
<head>
</head>
<script language=”javascript” type=”text/javascript”>
function SetValue(value)
{
self.opener.document.all(“tbValue”).value=value;
}
</script>
<body>
Values:<br/>
<a href=”javascript:SetValue(’1′)”>value 1</a><br/>
<a href=”javascript:SetValue(’2′)”>value 2</a>
</body>
</html>


\n

来源:http://blog.csdn.net/tinelonly

\n