我有个数据录入页面是由一个多行表格,表格行里有input文本框和文字组成,我想根据客户需要在程序中根据congig里的设置隐藏指定的行,且aspx页中有每个文本框都有对应的js表单检测语句,在asp中只需在<tr>和js检测语句块的前后用if语句就可控制显隐,在.net中只有在每行都穿插一个Panel控件这一种方法吗?那样会多出很多多作的DIV,大家有其它好的方法吗
调试欢乐多
先请求xml文件 dom读取xml文件应该隐藏哪一行
然后利用style.display="none";隐藏指定行
index.html
<script language="javascript">
var xmlDoc;
var line;
function hehe()
{
if(window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange=function()
{
if(xmlDoc.readyState==4)
{
handleXmlDoc();
}
}
xmlDoc.load("data.xml");
}
else if(document.implementation&&document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument('','',null);
xmlDoc.onload=handleXmlDoc;
xmlDoc.load("data.xml");
}
}
function hideLine(line)
{
var rows=document.getElementById("hehe").rows;
rows[line].style.display="none";
}
function handleXmlDoc()
{
var root=xmlDoc.documentElement;
var lines=root.getElementsByTagName("line")[0];
line=lines.firstChild.nodeValue;
hideLine(line);
}
window.onload=hehe;
</script>
<table id="hehe">
<tr>
<td><input value="Line1"/></td>
</tr>
<tr>
<td><input value="Line2"/></td>
</tr>
</table>
data.xml
<?xml version="1.0" encoding="GB2312"?>
<root>
<line>1</line>
</root>
aspx: <tr id="xxx" runat="server">
cs: if (configstr="1") {xxx.visibe=false}