Showing & hiding div layers on button clicks
แบบที่ 1
Here is the demo of controlling the display of layer by using single button
Here is the code of above demo
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
แบบที่ 2Here is the demo of controlling the display of layer by using single button
Here is the code of above demo
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<html>
<head>
<title>Demo of Show hide div layer onclick of buttons</title>
<META NAME="DESCRIPTION" CONTENT="Demo for showing and hiding div layers through button clicks">
<META NAME="KEYWORDS" CONTENT="Demo Show layer, Demo hide layer, display div, hide div, button on click, button on click event, div property, div style set">
<style type="text/css">
div {
position: absolute;
left: 250px;
top: 200px;
background-color: #f1f1f1;
width: 280px;
padding: 10px;
color: black;
border: #0000cc 2px dashed;
display: none;
}
</style>
<script language="JavaScript">
function setVisibility(id) {
if(document.getElementById('bt1').value=='Hide Layer'){
document.getElementById('bt1').value = 'Show Layer';
document.getElementById(id).style.display = 'none';
}else{
document.getElementById('bt1').value = 'Hide Layer';
document.getElementById(id).style.display = 'inline';
}
}
</script>
</head>
<body>
<input type=button name=type id='bt1' value='Show Layer' onclick="setVisibility('sub3');";>
<div id="sub3">Message Box</div>
<br><br>
</body>
</html>
Here is a the demo of show hide layer
ไม่มีความคิดเห็น:
แสดงความคิดเห็น