<a href="cardwall_ywxg.aspx" id="haha" ><span>与我相关</span></a
<span id="dds"><asp:Label BackColor="red" ID="Label1" runat="server" Text=""></asp:Label></span></div>
<script type="text/javascript">
function hideText()
{
var input = document.getElementsByTagName("span"); //获取页面所有span
for(var i=0;i<input.length;i++)
{
if(input.item(i).id.indexOf("dds") >= 0 )//判断span的id中是否包含dds字符串
{
document.getElementById(input.item(i).id).style.display = "none";//隐藏控件
}
}
} </script>
这样写能实现控件隐藏 但是页面加载之后就显示出来了 我不想让他显示出来应该怎么办 各位大师请教一下 急用 谢谢
<span id="dds"><asp:Label BackColor="red" ID="Label1" runat="server" Text=""></asp:Label></span></div>
<script type="text/javascript">
function hideText()
{
var input = document.getElementsByTagName("span"); //获取页面所有span
for(var i=0;i<input.length;i++)
{
if(input.item(i).id.indexOf("dds") >= 0 )//判断span的id中是否包含dds字符串
{
document.getElementById(input.item(i).id).style.display = "none";//隐藏控件
}
}
} </script>
这样写能实现控件隐藏 但是页面加载之后就显示出来了 我不想让他显示出来应该怎么办 各位大师请教一下 急用 谢谢
function hideText()
{
var input = document.getElementsByTagName("span"); //获取页面所有span
for(var i=0;i<input.length;i++)
{
if(input.item(i).id.indexOf("dds") >= 0 )//判断span的id中是否包含dds字符串
{
if(document.getElementById(input.item(i).id).style.display == "none")
{
document.getElementById(input.item(i).id).style.display = "block";
}
else
{
document.getElementById(input.item(i).id).style.display = "none";
}
}
}
}
</script>
{
string flagstr = strValue;
if (strValue == string.Empty)
{
return;
}
try
{
string XPath = "/configuration/appSettings/add[@key='?']";
XmlDocument domWebConfig = new XmlDocument(); domWebConfig.Load(filepath);
XmlNode addKey = domWebConfig.SelectSingleNode((XPath.Replace("?", key))); if (addKey == null)
{
return;
}
addKey.Attributes["value"].InnerText = strValue;
domWebConfig.Save(filepath);
Response.Write("ok!")
}
catch
{
return;
} }后台读取:public string flag=ConfigurationManager.AppSettings["flag"];
前台处理js bodyonload事件:
function f(flag){
if(flag==ooxx)//自己定
{
document.getElementById(input.item(i).id).style.display = "none";
}<body onload="f('<% =flag %>')">
</body>试试
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title> <script src="lib/jquery-1.4.2.js" type="text/javascript"></script> <script type="text/javascript">
function jf_remove(that) {
that.parentNode.removeChild(that);//自身元素的父节点的子元素(指定为本身)
}
</script></head>
<body>
<input type="button" value="点我就消失了" onclick="jf_remove(this)" />
</body>
</html>