Re: [問題]呼叫兩個不同網頁中的function

看板Ajax作者 (冒牌費大公)時間16年前 (2009/02/23 10:22), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串3/3 (看更多)
※ 引述《CoMix (CoMix)》之銘言: : 我有兩個網頁 : A.php B.php : │ │ : └ function go(); └ function show(); : 我想從 A.php function go(); 中去呼叫使用 B.php function show(); : 請問這樣是可以實現的嘛 ~ 應該怎麼寫才可以達到我要的目的 用iframe試作如下: A.php內容: <html> <body> <iframe src="B.php" id="target" name="target" style="display:none"></iframe> <script> function go(){ try { window.frames['target'].show(); } catch(e) { alert(e); } }; window.setTimeout(function(){go();},100); </script> </body> </html> B.php內容: <html> <script> function show() { alert("show"); } </script> <body> </body> </html> PS.因為你是在ajax版問,所以我假設你說的function go()與show()都是javascript的 function。 -- Sapere Aude! 這就是啟蒙運動的口號! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.250.95.16

02/25 01:56, , 1F
這個或許對你有些幫助 http://tinyurl.com/c7o296
02/25 01:56, 1F

02/25 01:57, , 2F
我不是張爸
02/25 01:57, 2F
文章代碼(AID): #19eWXyB0 (Ajax)
文章代碼(AID): #19eWXyB0 (Ajax)