Re: [請益] 利用表單內的另開視窗連結,傳送陣列資料
換個方式,改用新視窗到舊視窗抓資料呢?
給妳一個範列try看看~~
===== test.htm =====
<script language="javascript">
var tmp = Array(1,2,3);
</script>
<a href="javascript:void(0);" onclick="window.open('test2.htm');">另開視窗</a>
===== test2.htm =====
<script language="javascript">
function show() {
obj = window.opener;
alert(obj.tmp[0]);
}
</script>
<a href="javascript:void(0);" onclick="window.close();">關閉視窗</a><br />
<a href="javascript:void(0);" onclick="show();">show</a>
這樣不管要傳什麼型態的資料應該都可以
建議在window.open之前把要傳過去的資料整理到一個變數(方便新視窗使用)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.240.2.28
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章