我用下面的代码创建了一个名为“page.php”的文件。从PHP文件调用函数到另一个PHP文件?
<!DOCTYPE HTML>
<html>
<body>
<?php
require 'form.php';
?>
<a href="#" onclick="call_popup('form_container')">Click this link!</a>
</body>
</html>
我创建了另一个文件 “form.php的” 与下面的代码:
<script type="text/javascript">
function call_popup (container_id) {
var id= document.getElementById(container_id);
alert(id);
}
</script>
<div id="form_container">
<form>
<input type="text" />
<input type="button" value="submit" />
</form>
</div>
我想称之为 “call_popup(CONTAINER_ID)” 功能中的 “page.php文件”,这是在“form.php”中定义。当我点击“点击此链接!”它会给出错误,说找不到call_popup('form_container')
!
我哪里错了?
我试过包括('form.php')和require('form.php')..我尝试两种..但它不工作,它仍然给出了同样的错误! – indr