It does not work. When you click on a link, where do you want to execute a function? client-side or server-side? If you want to execute a function on the client side, then use javascript to do that. If you want to execute a function on the server side, you need to either change the url or do a form submission. Then you can execute the server-side function in that new page on the server-side.For example:<script language="javascript">
function clientFun()
{
alert("hello world");
}
</script>
<form action="whatever.php" method="post" name="frmtest">
<input type=hidden name="hello" value="world">
</form>
<a href="javascript:void(clientFun())">Client Side</a><BR>
<a href="javascript:void(location.href='another.php')">Change Link</a><br>
<a href="javascript:void(document.frmtest.submit())">Submit a form</a>
function clientFun()
{
alert("hello world");
}
</script>
<form action="whatever.php" method="post" name="frmtest">
<input type=hidden name="hello" value="world">
</form>
<a href="javascript:void(clientFun())">Client Side</a><BR>
<a href="javascript:void(location.href='another.php')">Change Link</a><br>
<a href="javascript:void(document.frmtest.submit())">Submit a form</a>
解决方案 »
- 高手看过来:修改apache配置文件httpd.conf后,导致应用无法访问的问题
- mysql inner join 性能问题
- 我看到原碼中有這個&是什麼意思???
- 如何设置,实现Linux系统下使用php中的函数mail()能成功发送邮件?
- 诚邀高手做个网上数码冲印系统,包括客户端和服务器端。价格面议。
- 请问高手如何用mail函数发支持html的邮件,谢谢!
- 一可以集成开发11种(Html,Js,Asp,Xml..)编程语言的中文软件!
- 关于页面刷新的问题
- php的文本输入框中的回车符用<br>代替的函数--
- 关于网站前台会员注册登录的一些疑问
- 请问如何将一个数组里的所有元素初始化,以消除error_reporting函数的除错?
- 菜鸟级问题——请高手帮我看看这段代码错在哪里?只要对,分子马上送上!
<?php
funcion hello()
{ echo "hello world!<br>"; } if(isset($sbt)){
hello();
}else{
?>
<script language=Javascript1.1>
function form_submit(){
document.test.submit();
return;
}
</script>
<form name=test action="submit.php" method=post>
<input type=hidden name=sbt value="1">
<a href="Javascript:form_submit()">执行服务器端函数</a>
</form>
<?php
}
?>