PHP访问MySql数据库 高级篇 AJAX技术(4)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-20 18:32 点击:次
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="smarty2.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="../jquery-1.7.min.js"></script>
<script type="text/javascript" src="smarty2.js"></script>
<title>{$smarty.const.DB_TABLENAME}</title>
</head>
<body>
<h1>表名:{$db_tablename}</h1>
<table id="Table" border="1" align="center" cellpadding="10" cellspacing="2" bordercolor="#ffaaoo">
<caption style="font-size:15px">当前记录数:<label id="tableRowCount">{$db_count}</label> <input type="button" value="Add" onclick="addFun()" /> </caption>
{foreach $db_coltitle as $col}
<th>{$col}</th>
{/foreach}
<th>操作</th>
{foreach $db_rows as $dbrow}
<tr>
{foreach $dbrow as $k=>$val}
<td>{$val}</td>
{/foreach}
<td>
<input type="button" value="Edit" onclick="editFun('{$dbrow['id']}', '{$dbrow['name']}', '{$dbrow['age']}');" />
<input type="button" value="Delete" onclick="deleteFun('{$dbrow['id']}')" />
</td>
</tr>
{/foreach}
</table>
<div id="editdiv" style="display:none;color:red;" align="center">
<form>
id:<input type=text id="editdiv_id" readonly="true" />
name:<input type=text id="editdiv_name" />
age:<input type=text id="editdiv_age" />
<input type=button name="Updata" value="Updata" onclick="updataFun()" />
</form>
</div>
<div id="adddiv" style="display:none;color:green;" align="center">
<form>
name:<input type=text id="adddiv_name" />
age:<input type=text id="adddiv_age" />
<input type=button name="Insert" value="Insert" onclick="insertFun()" / >
</form>
</div>
</body>
</html>
4.smarty2.js文件
新增加了表格的鼠标经过行变色效果
//在表格的第一列中查找等于指定ID的行
function SearchIdInTable(tablerow, findid)
{
var i;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>