Hide Div onClick
by lakshmipathi
HTML
<a href="#" onclick="show('mydiv')">Open DIV</a>
<p> There is lot of text </p>
<div id="mydiv">
<div id="mydiv-container">
<div id="mydiv-content">
<iframe src="https://www.webminal.org/terminal/proxy/index/" width="100%"></iframe>
<br>Click the link to close.
<br>
<a href="#" onclick="hide('mydiv')">Close</a>
</div>
</div>
</div>
CSS
body {
height: 100%;
background-color: #F0F0F0;
font-family: Arial, sans-serif;
}
#mydiv {
width: 100%;
height: 100%;
overflow: hidden;
left: 100px;
top: 100px;
position: absolute;
opacity: 0.5;
z-index: 200;
}
#mydiv-container {
margin-left: auto;
margin-right: auto;
}
#mydiv-content {
width: 100%;
padding: 20px;
background-color: white;
border: 1px solid #6089F7;
}
a {
color: #5874BF;
text-decoration: none;
}
a:hover {
color: #112763;
}
JavaScript
function show(target) {
document.getElementById(target).style.display = 'block';
}
function hide(target) {
document.getElementById(target).style.display = 'none';
}