HTML网页,点击回复后出现浮动的文本框,像下面那样,应该怎么做?
说说实现原理 ,先让编辑框显示 ,并且定位定好 ,然后让他隐藏 ,当点击 回复时显示就好了 ,点确定再隐藏
代码:
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#btn1{width: 80px; height: 40px; line-height: 40px; margin-left: 150px;}
#btn2{width: 80px; height: 40px; line-height: 40px;}
#textbox{width: 300px; height: 100px; position: absolute; left: 20px;top: 60px; display: none;}
</style>
</head>
<body>
<input id="btn1" type="button" value="回复">
<textarea id="textbox"></textarea>
<input id="btn2" type="button" value="确定">
<script type="text/javascript">
var oBtn1 = document.getElementById('btn1');
var oBtn2 = document.getElementById('btn2');
var oText = document.getElementById('textbox');
oBtn1.onclick = function(){
oText.style.display="block";
};
oBtn2.onclick = function(){
oText.style.display="none";
};
</script>
</body>
</html>
效果 : 点击回复显示 ,点击确定隐藏