日期:2014-05-16  浏览次数:20414 次

php如何判断鼠标是否点击了a标签
比如鼠标点击了a标签的时候
就调用php的 echo "<a>i</a>";
这样要怎么做 为什么网上找不到php的事件代码
求高手帮忙写下
PHP 鼠标 标签

------解决方案--------------------


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
xmlHttp = new XMLHttpRequest();
function click_A(value){
xmlHttp.open('GET','test.php?click=1',true);
xmlHttp.onreadystatechange = function(){
if((xmlHttp.readyState == 4)&&(xmlHttp.status ==200)){
document.getElementById('click').innerHTML = xmlHttp.responseText;
}//end of if

}//end of on readystatechange
xmlHttp.send();
}

</script>
<body>

<a id="click" onclick="click_A()">我是标签a,点击我</a>

</body>
</html>
<?php
if($_GET['click']){echo "<br />标签a已经被点击了";}
?>


/*********************************/
有点长不过很多都是没用的。就是Ajax的方法
------解决方案--------------------
<a onclick="func(this)">你</a>
<script>
function func(obj){
   obj.innerHTML='好';
}
</script>

------解决方案--------------------

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
 $(function (){
$("a").click(function(){
$(this).text('好');
});
})
</script>
<a href="#">你</a>