Prompt to Draw on Canvas
by LeroyRon
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<div id="button-number">
Button 1
</div>
<canvas id="ComplexPlane" width='5000' height='5000' style="border:1px solid #d3d3d3;"> </canvas>
JavaScript
$("#button-number").click(function() {
var realPart = prompt("Please, enter the real Part of the number:")
var imagPart = prompt("Please, enter the imaginary Part of the number:")
if (realPart != null && imagPart != null) {
var c = document.getElementById("ComplexPlane");
var number = c.getContext("2d");
number.beginPath();
number.arc(realPart,imagPart,10,0,2*Math.PI);
number.stroke();
}
});