鼠标移动到热点上,显示详细信息
来源:互联网 发布:局域网远程关机软件 编辑:程序博客网 时间:2024/05/16 06:20
鼠标移动到热点上,显示详细信息
1.userController文件
public functionshowDetailAction(){
$userModel=new userModel("localhost","liuyanban","root","123");
$rows = $userModel->searchAll();
$this->smarty->assign('list',$rows);
$this ->smarty->display("showDetail.tpl");
}
public function processAction(){
$user_id =$_REQUEST['user_id'];
$userModel=new userModel("localhost","liuyanban","root","123");
$row = $userModel->getOne($user_id);
echo json_encode($row);
}
2.userModel文件
public function search($username){
$sql="select username from user where username='".$username."'";
//var_dump($sql);
$result =mysql_query($sql);
$row =mysql_fetch_assoc($result);
return $row;
}
public function searchAll(){
$sql="select * from user";
$result =mysql_query($sql);
$rows = array();
while($row =mysql_fetch_assoc($result)){
$rows[] =$row;
}
3.showDetail文件
<table align="center">
<tr>
<th>显示详细信息</th>
</tr>
<{foreach from=$list item="value"}>
<tr style="background-color:#F9F">
<tdid="name_<{$value.user_id}>"><{$value.user_id}></td>
<tdonMouseOver="showDetai(<{$value.user_id}>)"
onmouseout="hideDetail(<{$value.user_id}>)">
<{$value.username}></td>
</tr>
<{/foreach}>
</table>
<script>
functionshowDetai(user_id){
var xhr;
if(window.ActiveXobject){
xhr = newActiveXobject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xhr =new XMLHttpRequest();
}
xhr.open("POST","index.php?c=user&a=process",true);
xhr.onreadystatechange=callback;
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xhr.send('user_id='+user_id);
function callback(){
if(xhr.readyState==4){
if(xhr.status==200){
var json = eval('('+xhr.responseText+')');
var new_div =document.createElement('div');
new_div.style.backgroundColor="#ccc";
new_div.style.position="absolute";
new_div.id="new_div"+user_id;
new_div.style.marginLeft='170px';
new_div.innerHTML="id:"+json.user_id+"<br/>username:"+json.username+"<br/>loginime:"+json.loginime;
document.getElementById('name_'+user_id).appendChild(new_div)
}
}
}
}
function hideDetail(user_id){
var new_div =document.getElementById("new_div"+user_id);
document.getElementById("name_"+user_id).removeChild(new_div);
}
</script>
- 鼠标移动到热点上,显示详细信息
- 鼠标移动到热点上,显示详细信息
- 鼠标移动到热点上,显示详细信息(显示数据库的信息)
- 利用MVC和Ajax实现->鼠标移动到热点上,显示详细信息
- 鼠标移动显示详细信息监听实现
- JQuery_鼠标移动到图标上显示相应信息
- Flex 中鼠标移动到Label上显示手型
- 鼠标移动到图片上右边显示放大镜效果。
- 鼠标移动到控件上显示提示信息
- [MFC] 鼠标移动到控件上显示提示信息
- JQuery鼠标移动到div上,显示提示
- MFC鼠标移动到按钮上显示其他形状
- 鼠标移动到某文字上然后显示图片
- 鼠标移动到div上显示子div实现要点
- HTML鼠标移动到图片上时显示阴影边框
- 鼠标移动到链接上显示提示文字
- 鼠标移动在文字上面,让其显示详细信息
- 鼠标点击显示详细信息
- 存储过程和视图的应用
- 2012金院Csdn高校俱乐部技术交流会
- 4clojure第135个问题:中缀计算器
- 完成类似百度搜索建议
- 【Java】Java调用本机运行环境运行程序
- 鼠标移动到热点上,显示详细信息
- Linux tar 命令示例说明及Linux zip、rar压缩方式介绍
- “第二课堂”开课啦
- 百钱百鸡的问题
- poj2251 三维搜索 利用优先队列
- PHP面试题汇总
- 百度开放研究社区-电影推荐系统算法创新大赛
- 记忆化搜索 uva-10651-Pebble Solitaire
- Python笔记