1 回答

TA貢獻1876條經驗 獲得超6個贊
<span id="aa">
<%
c="aaaaaaaa"
response.write(c)
%></span>
用JavaScript從兩個頁面取值,就是兩個窗口的父子關系,都可以做到,但這樣做的問題是要兩個窗口都存在,即B.html要么是open出來的,要么就是嵌在a.asp的一個div,iframe,或什么東西中.
我曾嘗試從A轉到B,取A的值,沒有成功.
a.html
<HTML>
<HEAD>
</HEAD>
<script>
function fun(){
var param = "width = 590px,height=420px,menubar = no,toolbar = no,location = no,directries = no,scrollbars = no,status = no,resizable = no, left= 220, top = 150";
window.open("b.html","",param);
}
</script>
<BODY>
<span id="aa">aaaaaa</span>
<input type="button" value="c" onclick="fun();">
</BODY>
</HTML>
b.html
<HTML>
<HEAD>
</HEAD>
<script>
function fun(){
document.getElementById("a").value= window.opener.document.getElementById("aa").innerText;
}
</script>
<BODY onload="fun();">
<input type="text" id="a" value="">
</BODY>
</HTML>
添加回答
舉報