Tuesday, September 2, 2014

SHOW AND HIDE DIV USING JAVASCRIPT

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>hide and display</title>
<script language="javascript">
function hideform(id,attribute)
{
document.getElementById(id).style.visibility= attribute;
}
</script>
</head>
<body>
<a href='#' onclick="hideform('loginfrm','visible')" >For login Click Here</a>
<div id='loginfrm' style="visibility:hidden;">
<form name='frm' action="login.php" method="post">
<table>
<TR><TD>Enter UserName:</TD><TD><input type="text" name="uname" /></TD></TR>
<TR><TD>Enter Password:</TD><TD><input type="text" name="upass" /></TD></TR>
<TR><TD><input type="submit" name="login" value="login"/></TD>
<TD><a href="#" onclick="hideform('loginfrm','hidden')">Close</a></TD></TR>
</table>
</form>
</div>
</body>
</html>

No comments: