html表格设计问题,当无记录时显示提示“无记录”,但添加后该提示如何隐藏,如何修改,代码如下:

<html><head><styletype="text/css">table{font:normal12pxauto;color:#4f6b72;background:... <html>
<head>
<style type="text/css">
table {
font: normal 12px auto;
color: #4f6b72;
background: #E6EAE9;
height:30px;
width: 220px;
padding: 0;
margin: 0;
font: normal 11px auto ;
color: #4f6b72;
background: #E6EAE9;
}
th {
font: bold 14px;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: center;
padding: 6px 6px 6px 12px;
background: #CAE8EA no-repeat;
}
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 0;
border-left: 0;
font-size:12px;
padding: 6px 6px 6px 12px;
background: #f5fafa;
}
</style>
<script language="javascript">
function findObj(theObj, theDoc){
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById)
foundObj = document.getElementById(theObj);
return foundObj;
}

function AddSignRow(){
var txtTRLastIndex = findObj("txtTRLastIndex",document);
var rowID = parseInt(txtTRLastIndex.value);

var signFrame = findObj("SignFrame",document);

var newTR = signFrame.insertRow(signFrame.rows.length);
newTR.id = "SignItem" + rowID;

var newNameTD=newTR.insertCell(0);
newNameTD.innerHTML = newTR.rowIndex.toString();

var newKeyTD=newTR.insertCell(1);
newKeyTD.innerHTML = "<input name='Keys" + rowID + "' id='Keys" + rowID + "' type='text' size='20' style='width:150px'/>";
txtTRLastIndex.value = (rowID + 1).toString() ;
}
function DeleteSignRow(rowid){
var signFrame = findObj("SignFrame",document);
var signItem = findObj(rowid,document);
var rowIndex = signItem.rowIndex;
signFrame.deleteRow(rowIndex);
for(i=rowIndex;i<signFrame.rows.length;i++){
signFrame.rows[i].cells[0].innerHTML = i.toString();
}
}
</script>
</head>
<body ><div>
<input type="button" name="Submit" value="添加" onClick="AddSignRow()" />
<input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
</div>
<div class=a>
<table border="0" cellpadding="2" cellspacing="0" id="SignFrame" >
<tr id="trHeader">
<th width="33.3" align="center">编号</th>
<th width="150">关键字</th>
</tr>
<tr align="center" class="bg_white">
<td class="bg_white" align="center" colspan="10">无记录!</td>
</tr> </table>
</div></body>
</html>
展开
 我来答
缓步莫迟疑C
推荐于2016-10-29 · TA获得超过1.1万个赞
知道大有可为答主
回答量:6217
采纳率:73%
帮助的人:6705万
展开全部
<html>
<head>
<style type="text/css">
table {
font: normal 12px auto;
color: #4f6b72;
background: #E6EAE9;
height:30px;
width: 220px;
padding: 0;
margin: 0;
font: normal 11px auto ;
color: #4f6b72;
background: #E6EAE9;
}
th {
font: bold 14px;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align: center;
padding: 6px 6px 6px 12px;
background: #CAE8EA no-repeat;
}
td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 0;
border-left: 0;
font-size:12px;
padding: 6px 6px 6px 12px;
background: #f5fafa;
}
</style>
<script language="javascript">
function findObj(theObj, theDoc){
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById)
foundObj = document.getElementById(theObj);
return foundObj;
}

function AddSignRow(){
document.getElementById('norecord').style.display='none';
var txtTRLastIndex = findObj("txtTRLastIndex",document);
var rowID = parseInt(txtTRLastIndex.value);

var signFrame = findObj("SignFrame",document);

var newTR = signFrame.insertRow(signFrame.rows.length);
newTR.id = "SignItem" + rowID;

var newNameTD=newTR.insertCell(0);
newNameTD.innerHTML = newTR.rowIndex.toString();

var newKeyTD=newTR.insertCell(1);
newKeyTD.innerHTML = "<input name='Keys" + rowID + "' id='Keys" + rowID + "' type='text' size='20' style='width:150px'/>";
txtTRLastIndex.value = (rowID + 1).toString() ;
}
function DeleteSignRow(rowid){
var signFrame = findObj("SignFrame",document);
var signItem = findObj(rowid,document);
var rowIndex = signItem.rowIndex;
signFrame.deleteRow(rowIndex);
for(i=rowIndex;i<signFrame.rows.length;i++){
signFrame.rows[i].cells[0].innerHTML = i.toString();
}
}
</script>
</head>
<body ><div>
<input type="button" name="Submit" value="添加" onClick="AddSignRow()" />
<input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
</div>
<div class=a>
<table border="0" cellpadding="2" cellspacing="0" id="SignFrame" >
<tr id="trHeader">
<th width="33.3" align="center">编号</th>
<th width="150">关键字</th>
</tr>
<tr align="center" class="bg_white">
<td id="norecord" class="bg_white" align="center" colspan="10">无记录!</td>
</tr> </table>
</div></body>
</html>
更多追问追答
追问
我这有一些改动,同时虽然能够隐藏,但是又出现一个问题,就是编号不是从1开始的
我重新提问,麻烦你在看下,另外就是,我添加一个删除按钮,加入把所有记录删除完了,如何让提示再显示出来?
提问的题目只在最前面加上“关于”2字,其他不变
追答
那先把这贴结了吧.
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式