copy data between form fields by javascript
JavaScript:
<script type="text/javascript">
function CopyAddress()
{
if(document.getElementById("ctl00_cphhead_chkpresentaddress").checked)
{
document.getElementById("ctl00_cphhead_txtpermantaddress").value=document.getElementById("ctl00_cphhead_txtaddress").value;
}
else
{
document.getElementById("ctl00_cphhead_txtpermantaddress").value="";
}
}
</script>
Present Address TextBox:
<asp:TextBox ID="txtaddress" runat="server" TextMode="MultiLine" Height="50px"
Width="140px" onkeyup="CopyAddress();"></asp:TextBox></td>
CheckBox:
<asp:CheckBox ID="chkpresentaddress" runat="server" onclick="CopyAddress();" />
JavaScript:
<script type="text/javascript">
function CopyAddress()
{
if(document.getElementById("ctl00_cphhead_chkpresentaddress").checked)
{
document.getElementById("ctl00_cphhead_txtpermantaddress").value=document.getElementById("ctl00_cphhead_txtaddress").value;
}
else
{
document.getElementById("ctl00_cphhead_txtpermantaddress").value="";
}
}
</script>
Present Address TextBox:
<asp:TextBox ID="txtaddress" runat="server" TextMode="MultiLine" Height="50px"
Width="140px" onkeyup="CopyAddress();"></asp:TextBox></td>
CheckBox:
<asp:CheckBox ID="chkpresentaddress" runat="server" onclick="CopyAddress();" />
Comments
Post a Comment