Re: [問題]呼叫兩個不同網頁中的function
※ 引述《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
02/25 01:56, 1F
→
02/25 01:57, , 2F
02/25 01:57, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章