jsp html 实现隐藏输入框,点击可以取消隐藏&&弹出输入框
jsp代码:
<script language="javascript" type="text/javascript">
function chg (){
if(document.getElementById('mydiv').style.display=="none"){
document.getElementById('mydiv').style.display="";
}
}
</script>
html代码:
echo "<input type='button' value='评论' onclick='chg()'>
<div id='mydiv' style='display:none;'>
<form id='myform' >
<input type='textbox' id='pinlun' >
<input type='submit' id='sbmt' value='提交' >
</form>
</div>";
、、、、、、、、、、、、、、
<script language="javascript" type="text/javascript">
function review(){
var ret = prompt("请输入评论内容!","");
if (ret == null){
return false;
}else if (ret.replace(/^\s+|\s+$/g,"") == ""){
alert("输入内容为空!");
return false;
}
document.getElementById("TextBox1").value=ret;
}
function transmit(){
var ret = prompt("请输入转发感慨!","");
if (ret == null){
return false;
}else if (ret.replace(/^\s+|\s+$/g,"") == ""){
alert("输入内容为空!");
return false;
}
document.getElementById("TextBox1").value=ret;
}
</script>
$review_button_name='review'.$user_id."_".$row['user_id'];
$transmit_button_name='transmit'.$user_id."_".$row['user_id'];
echo "<a href='blogProcess.php' onclick='return review()' class='href_style'>评论</a>
<a href='blogProcess.php' onclick='return transmit()' class='href_style'>转发</a>";