It is known as dynamic javascript!
See this example:
Code:
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<script type="text/javascript">
<!--
function toggle() {
var div = document.getElementById('div');
if(div.style.display == 'none') div.style.display = 'block';
else div.style.display = 'none';
}
//-->
</script>
</head>
<body>
<input onclick="toggle()" type="button" value="hide" />
<div id="div">
Hello world</div>
</body>
</html>
Bookmarks