jsp代碼:javascript
<script language="javascript" type="text/javascript">php
function chg (){html
if(document.getElementById('mydiv').style.display=="none"){java
document.getElementById('mydiv').style.display="";jsp
} spa
}orm
</script>htm
html代碼:blog
echo "<input type='button' value='評論' onclick='chg()'>ip
<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>";