what am I missing here. I would like to hide the textbox and label until the user click the checkbox. please help and as always your help is appreciated.
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="checkboxhideandshow.aspx.vb" Inherits="testhide" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head >
<script type="text/javascript">
function ShowHide(obj)
{
if(!obj.checked)
{
document.getElementById('trucking').style.display = 'none';
document.getElementById('trucking').style.visibility="hidden";
document.getElementById('lblTrucking').style.display = 'none';
document.getElementById('lblTrucking').style.visibility="hidden";
}
else
{
document.getElementById('trucking').style.display = '';
document.getElementById('trucking').style.visibility ="visible";
document.getElementById('lblTrucking').style.display = '';
document.getElementById('lblTrucking').style.visibility ="visible";
}
}
</script>
<title>Textbox Hide and Show</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBox ID="chkTruking" runat="server" Text="Trucking / Broker / TIOs" onclick="ShowHide(chkTruking)" /> <br /> <br /> <br />
<asp:Label ID="lblTrucking" runat="server" Text="US DOT Number:"></asp:Label>
<asp:TextBox ID="trucking" runat="server" ></asp:TextBox>
</div>
</form>
</body>
</html>