<style>
.div {
position: fixed;
left: 20%;
top: 20%;
height: 60%;
width: 60%;
background: lightgrey;
z-index: 10;
display: none;
}
</style>
<button class="open">click</button>
<textarea></textarea>
<div class="div">
<input>
<input type="button" value="insert">
</div>
<script>
window.onload = function () {
var but = document.body.children[0];
var ta = document.body.children[1];
var div = document.body.children[2];
var inp = div.children[0];
var ins = div.children[1];
but.onclick = function () {
var s = div.style;
if (s.display != 'block') {
s.display = 'block';
} else {
s.display = 'none';
}
}
ins.onclick = function () {
ta.value += '[js]' + inp.value + '[/js]';
}
}
</script>