Ich möchte ein Bestätigungsdialogfeld anzeigen, wie "Möchten Sie fortfahren?" Wenn "Ja", möchte ich eine Nachricht mit Formularausgabe ausgeben, wenn "Nein" ich auf der gleichen Seite bleiben möchte.Ich möchte einen Bestätigungsdialog anzeigen, bevor die Ausgabe angezeigt wird.
Im folgenden Code navigiere ich zu facto.html
für die Ausgabe der Ausgabe, aber ich möchte stattdessen ein Popup mit seinem Inhalt anzeigen. Wie kann ich das machen?
Mein index.html
:
<!DOCTYPE html>
<html>
<head>
<title>Lift From Scratch</title>
<script type="text/javascript">
<!--
function getConfirmation(){
var retVal = confirm("Do you want to continue ?");
if(retVal == true){
<!--document.write("continue")-->
<!--window.location.href = '/facto.html';-->
return true;
}
else{
alert("Don't continue")
<!--window.location.href = 'index.html';-->
return false;
}
}
//-->
</script>
</head>
<body>
<h1>Finding Factorial</h1>
<div id="main" class="lift:surround?with=default&at=content">
<form method="post">
<table>
<tr><td> Enter a Number:</td> <td><input name="num" type="number"></td></tr>
<tr><td><input type="submit" value="Submit" onclick="getConfirmation();" formaction="facto"></td>
<td><input type="reset" value="Reset"></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
facto.html:
<div data-lift="factorial">
<p>Factorial is: <span name="paramname"></span></p>
</div>