I have posted it before, but i didn't get some clear answer. I am very confused about this:
i have the following html:
<body onload="showcontent()"> <!-- onload optional -->
<div id="content"><img src="loading.gif"></div> <!-- leave img out if not onload -->
</body>
I also have the following script:
function showcontent(){
if(window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 1) {
document.getElementById('content').innerHTML = "<img src='loading.gif' />";
}
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById('content').innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', 'elsevier.php', true);
xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlhttp.send(null);
}
In elsevier.php I want when the rows of a table exceed 500 two buttons to be displayed, telling me whether to continue or cancel. If I put this code in the .php file nothing happens..... (except that two buttons appear).
if(mysqli_errno($con)==1062){
@$q55="SELECT COUNT(*) FROM testarticles";
$result55 = mysqli_query($con, $q55);
$row = $result55->fetch_row();
echo '#: ', $row[0].'<br>';
if($row[0]>=500&&$answer==false){
echo '<form action="" method="GET">';
echo "<label>Do you want to continue or cancel?</label>";
echo '<input type="button" id="but1" name="but1" value="Continue">';
echo '<input type="button" id="but2" name="but2" value="Cancel">';
echo '</form>';
if(isset($_GET["but1"])){
$answer=true;
break;
}
elseif(isset($_GET["but2"])){
@$q56="DELETE * FROM journal, volume, issue, articles, testarticles WHERE import_time=$unixtimestamp";
$result56 = mysqli_query($con, $q56);
exit;
}
}
I want in this step the execution of the php script to stop and to display me the two buttons to choose from. If i press continue i want the script to execute from where it was stopped.
Has anybody any idea?? I have tried several things but nothing works... Thank you in advance!
尝试使用input type="submit"
代替input type="button"
,提交将(显然)提交表单,button只是button,当您单击它时,如果您未将动作与js或随你。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.