++复制代码++ 代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Demo </TITLE>
</HEAD>
<BODY>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function clickImg(){
$.ajax({
type:"post", //提交类型
url:"demo.php", //提交页面
//data:"row="+row,
success:function(msg) {
$("#number").text(msg);
} //成功则输出
});
}
</script>
<span id="demo"><img src="c:\00.png" id="img" name="img" onclick="clickImg()" /></span>
<span id="number"></span>
</BODY>
</HTML>
以上是HTML页面代码
++复制代码++ 代码如下:
<?php
$link = mysql_connect('192.168.1.11','root','12345');
mysql_select_db("mltest", $link);
$strlan = mysql_query("UPDATE newtable SET click = click +1 WHERE id='1'");
$str = mysql_query("select click from newtable WHERE id = '1'");
while($row = mysql_fetch_array($str))
{
echo $row['click'];
}
?> // 对数据库进行操作,并返回值
以上的PHP页面代码。
使用的是jquery1.4.1版类库