C#
string fblink = WebConfigurationManager.AppSettings["facebook"];
if (fblink == "")
{
//need code to disable <li>
}
HTML
<div >
<ul>
<li id="face">
<a id="fb" runat="server" target="_blank" href="<%$ AppSettings:facebook %>"></a>
</li>
</div>
In web.config file added a key named facebook with value. If this value is empty the li tag should disable
If you want to access the <li>
in back-end means you should give runat="server"
as tag attribute. if so The li
will looks like the following:
<li id="face" runat="server"> .. </li>
So that you can access them like this:
if (fblink == "")
{
face.Visible=false;
}
By using javascript:
var fblink = '<%= System.Configuration.ConfigurationManager.AppSettings["facebook"].ToString() %>';
if (fblink == "")
{
var liElement = document.GetElementByID("face");
liElement.style.display = 'none';
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.