我想在单击提交按钮时出现的元素上创建一个提交按钮
第1步:我在' index.php'然后我点击一个按钮开始一个评论框,该评论框由一个java脚本函数调用,它来自一个评论.php'
步骤2:我想在被调用元素上插入一个提交按钮(如注释按钮)。
第1页
function showcomment(question_ID) {
var request;
try {
request = new XMLHttpRequest();
} catch (tryMicrosoft) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (otherMicrosoft) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}
var php = "./core/show-comment.php";
var comment_content = document.getElementById("comment_content_" + question_ID).value;
var vars = "comment_content=" + comment_content + "&user_ID=" + user_ID + "&question_ID=" + question_ID;
request.open("POST", php, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
var return_data = request.responseText;
document.getElementById(question_ID).innerHTML = return_data;
}
}
request.send(vars);
}

<input type='submit' name='comment' value='show comment' onclick='fonction()'>
&#13;
第2页
<type="submit" name="like">
<?php
if (isset($_POST['like']))
{
$query_new_like = "UPDATE comments SET approval_rate = approval_rate +1 WHERE comment_ID = '$comment_ID'" ;
mysqli_query ($connect,$query_new_like) ;
}
?>
&#13;