| 域名空间 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 韩国素材 | 素材图库 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
想了好一段时间,终于让我想出来了。不过功能不太完善,希望大家帮我修一修改一改。http://www.iyit.net 日期:2006-10-6 15:35:04 来源:iyit.net收集 点击: |
主要功能:可以在当前位置,实时的修改数据库里的内容,不用提交到另外一个页面。 有很多的不足之处,希望大家能帮我完善一下,在下先谢过了。 文件abc.php ================= <?php require_once('connections/temp.php'); ?> <?php /* # # 数据表的结构 `temp` # create table temp ( id int(3) not null auto_increment, name char(10) default null, primary key (id), key id (id) ) type=myisam; */ mysql_select_db($database_temp, $temp); if(isset($delete)&& isset($menuname)){ $query="delete from temp where name='".$menuname."'"; $result=mysql_query($query,$temp) or die(mysql_error()); if(!$result) echo "<script>alert('删除失败,请重试!')</script>"; } $query_recordset1 = "select * from temp order by id asc"; $recordset1 = mysql_query($query_recordset1, $temp) or die(mysql_error()); $row_recordset1 = mysql_fetch_assoc($recordset1); $totalrows_recordset1 = mysql_num_rows($recordset1); ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=gb2312"> <title>实时动态修改,添加,删除</title> </head> <body> <!--右键菜单开始//--> <div id="menu" onmouseup="this.style.display='none'" style="position:absolute; z-index:1;display:none"> <table width="80" border="1" cellpadding="0" cellspacing="1" bordercolor="#666666" bgcolor="#ffffff"> <tr> <td align="center" bordercolorlight="ffffff" bordercolordark="000000" bgcolor="#ffffff"><a href="javascript:add()"><font color="#000000">添加</font></a></td> </tr> <tr> <td align="center" bordercolorlight="ffffff" bordercolordark="000000" bgcolor="#ffffff"><a href="javascript:modify()"><font color="#000000">修改</font></a></td> </tr> <tr> <td align="center" bordercolorlight="ffffff" bordercolordark="000000" bgcolor="#ffffff"><a href="javascript:deletemenu()"><font color="#000000">删除</font></a></td> </tr> </table> </div> <!--右键菜单结束//--> <table width="200" id=tbl border="1" cellpadding="3" cellspacing="0" bordercolor="#ff00ff"> <?php if ($totalrows_recordset1 > 0) { // show if recordset not empty ?> <?php do { ?> <tr> <td id="<?php echo td.$row_recordset1['id']; ?>"><?php echo $row_recordset1['name']; ?></td> </tr> <?php } while ($row_recordset1 = mysql_fetch_assoc($recordset1)); ?> <?php }else{ // show if recordset not empty ?> <tr><td id="td0">数据库中无记录....</td></tr> <?php }?> </table> <script language="javascript"> <!-- /*删除项目*/ function deletemenu(){ sre=eval(s); menuname=sre.innertext;//获取当前项目内容 location.href=self.name+"?delete=1&menuname="+menuname;//刷新本页面,并传递两个用于删除的参数 } /*显示一个输入框,为添加项目做准备*/ function add(){ tbl.insertrow().insertcell().innerhtml ="<iframe src='inputtxt.php?type=add' onblur='insertmenu();' id='submitall' width=100 height=20 marginwidth='0' marginheight='0' scrolling='no' frameborder='0'></iframe>"; } /*增加项目,提交数据*/ function insertmenu(){ rowofindex=event.srcelement.parentelement.parentelement.rowindex;//获得当前行号 dis=submitall.form1.intxt.value;//取得增加的值 tbl.rows[rowofindex].cells[0].id="td"+rowofindex+1;//该命名为修改做准备 a="tbl.rows["+rowofindex+"].cells[0]"; submitall.form1.submit(); t2=settimeout("enddisplay('"+a+"','"+dis+"')",2000);//给出一定时间提交表单处理数据 } /*显示一个输入框,为修改项目做准备*/ function modify(){ //s=event.srcelement.id; if(s=="submitall" ¦ ¦s=="")return; aaa=eval(s); aaatxt=aaa.innertext; aaa.innerhtml="<iframe src='inputtxt.php?type=modify' onblur=modifymenu('"+s+"') id='submitall' width=100 height=20 marginwidth='0' marginheight='0' scrolling='no' frameborder='0'></iframe>"; t1=settimeout("intxtvalue('"+aaatxt+"')",500);//给出一定的加载inputtxt.php的时间 } /*提交修改后的内容*/ function modifymenu(a){ dis=submitall.form1.intxt.value;//取得修改后的内容 submitall.form1.submit(); t2=settimeout("enddisplay('"+a+"','"+dis+"')",2000);//给出一定时间提交表单处理数据 } /*在输入框中加载原始内容,决定是否修改。*/ function intxtvalue(a){ submitall.form1.intxt.value=a; submitall.form1.oldintxt.value=a;//修改表中的数据时用到该值,以确定替换 } /*最后显示结果*/ function enddisplay(ab,adis){ dis1=eval(ab); if(adis=="")return; dis1.innerhtml=adis; } /*显示自定义右键菜单*/ function di --------------------------------------------------------------- 嘿,谢谢楼上的 mark --------------------------------------------------------------- up --------------------------------------------------------------- temp.php呢? --------------------------------------------------------------- 这个想法就很不错 支持,还没细看 --------------------------------------------------------------- temp.php没有 --------------------------------------------------------------- 使用iframe过渡?弯子绕大了点。 两处的延时500和2000有些不妥,宜用onload事件。 --------------------------------------------------------------- temp.php中应该没什么重要的内容,连接到数据库就行了。 --------------------------------------------------------------- 很遗憾!经测试,你的程序浏览器表现正常,但不能对数据库做除select以外的操作 --------------------------------------------------------------- 经再次调试,增、修改可以了,删仍然不行 --------------------------------------------------------------- mark --------------------------------------------------------------- mozilla 1.5中完全不能用. 1.右键菜单出不来. 2.即使让菜单显示,其功能也不能用.导致iframe无法正确显示 --------------------------------------------------------------- 我的是xp系统,也是只能做select,其他的不行。 --------------------------------------------------------------- 努力 --------------------------------------------------------------- mark --------------------------------------------------------------- mark 编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:怎么取出一个网页里的所有链接 下一篇:一段根据表中日期字段建立的树型目录的代码,有人帮我改成用类来编写吗? 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 相关文章 | ||||
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||