作者fillano (冒牌费大公)
看板Ajax
标题Re: [问题]呼叫两个不同网页中的function
时间Mon Feb 23 10:22:49 2009
※ 引述《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
2F:→ clonn:我不是张爸 02/25 01:57