当有人点击链接时如何调用函数? [英] how to call a function when somebody click a link?

查看:76
本文介绍了当有人点击链接时如何调用函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个链接

当有人点击链接时

php脚本调用一个函数,然后显示自己:)


i已经尝试了

< a href =<? funtion(); echo = $ _ server [''php_self'']?> text< / a>

但它会调用该函数是否我点击链接

然后我试了这个(使用表格)

< form action ="<?php function(); echo"< script>" ;; echo

" window.location.href = $ _ SERVER [''PHP_SELF'']" ;; echo''< / script>'';?>">

< input type =" submit"值= QUOT;文本" />< / form>

但它也没有用。

我的浏览器说有解析错误,T_STRING预期或

某事.... :(

现在我正在考虑使用一个标志,比如说,$ functioncall,

href = $ _ server [request_url]& functioncall = 1
然后如果functioncall == 1,调用该函数

但是它是对的吗?

有一些简单的方法吗?

任何建议都表示赞赏:)

解决方案

_server [''php_self'']?> text< / a>

但它会调用该函数是否我点击链接

然后我尝试了这个(使用表格)

< form action =" <?php function(); echo"< script>" ;; echo

" window.location.href =


_SERVER [''PHP_SELF'']" ;; echo''< / script>'';?>">

< input type =" submit"值= QUOT;文本" />< / form>

但它也没有用。

我的浏览器说有解析错误,T_STRING预期或

某事.... :(

现在我正在考虑使用一个标志,比如说,


functioncall,

href =

i want to creat a link
when somebody click the link
the php script calls a function,then display itself :)

i have tried
<a href=<? funtion(); echo=$_server[''php_self''] ?>text</a>
but it will call the function whether i click the link
then i tried this (using forms)
<form action="<?php function(); echo "<script>"; echo
"window.location.href=$_SERVER[''PHP_SELF'']"; echo ''</script>'';?>">
<input type="submit" value="text" /></form>
but it didnot work either.
my browser said there were parse errors,T_STRING expected or
something....:(
now i am thinking using a flag,say,$functioncall,
href=$_server[request_url]&functioncall=1
then if functioncall==1,call that function
but is it right?
is there some way simple to do that?
any suggestion is appreciated :)

解决方案

_server[''php_self''] ?>text</a>
but it will call the function whether i click the link
then i tried this (using forms)
<form action="<?php function(); echo "<script>"; echo
"window.location.href=


_SERVER[''PHP_SELF'']"; echo ''</script>'';?>">
<input type="submit" value="text" /></form>
but it didnot work either.
my browser said there were parse errors,T_STRING expected or
something....:(
now i am thinking using a flag,say,


functioncall,
href=


这篇关于当有人点击链接时如何调用函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆