Automatically Anable and Desable html tag using JavaScript

K011gusain89
Posted by K011gusain89 under JavaScript category on | Points: 40 | Views : 929
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
var t;
function ED() {
var div_to_disable = document.getElementById('<%=pnl.ClientID %>').getElementsByTagName("input");
var children = div_to_disable; //.childNodes;
for (var i = 0; i < children.length; i++)
{
children[i].disabled = true;
};
t = setTimeout("EE()", 1000);
}

function EE() {
var div_to_disable = document.getElementById('<%=pnl.ClientID %>').getElementsByTagName("input");
var children = div_to_disable; //.childNodes;
for (var i = 0; i < children.length; i++)
{
children[i].disabled = false;
};
t = setTimeout("ED()", 1000);
}
</script>
<link href="StyleSheet1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div><input type="button" name="name" value=" Test" onclick="ED();" />
<asp:Panel ID="pnl" runat="server">


<asp:Button ID="btn1" runat="server" Text="A" Font-Bold="true" Font-Size="XX-Large" /><br /><br />
<asp:Button ID="Button1" runat="server" Text="B" Font-Bold="true" Font-Size="XX-Large" /><br /><br />
<asp:Button ID="Button2" runat="server" Text="C" Font-Bold="true" Font-Size="XX-Large" /><br /><br />
<asp:Button ID="Button3" runat="server" Text="D" Font-Bold="true" Font-Size="XX-Large" /><br /><br />
<asp:Button ID="Button4" runat="server" Text="E" Font-Bold="true" Font-Size="XX-Large" /><br /><br />
<br />

<br />
<br />

</div>
</asp:Panel>

</form>

</body>
</html>

Comments or Responses

Login to post response