jquery - How to drop in a ball into a box when a text is accepted (javascript) -
jquery - How to drop in a ball into a box when a text is accepted (javascript) -
i created simple website has 3 boxes: when click on box, javascript prompt open , inquire text. after text accepted, ball should dropped box. how can that? code used:
<html> <head id = "hd"> <meta charset = "utf-8" /> <!--<meta name = "format-detection" --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" /> <script type="text/javascript"> // function init () { // } function myfunction() { var person = prompt("please come in thoughts"); } </script> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <div> <canvas id="mycanvas"></canvas> </div> </div> <!--<p id = "demo"></p>--> <div class="fixed-size-square" onclick="myfunction()"> <span>past thoughts</span> </div> <div class="size-square" onclick="myfunction()"> <span>present thoughts</span> </div> <div class="square"onclick="myfunction()"> <span>future thoughts</span> </div> </div> <div><button>i've no thoughts</button></div> <script type="text/javascript"> var canvas = document.getelementbyid('mycanvas'); var context = canvas.getcontext('2d'); var centerx = canvas.width / 2; var centery = canvas.height / 2; var radius = 70; context.beginpath(); context.arc(centerx, centery, radius, 0, 2 * math.pi, false); context.fillstyle = 'green'; context.fill(); context.linewidth = 5; context.strokestyle = '#003300'; context.stroke(); </script> </body> </html>
this code might help.
<html> <head id = "hd"> <meta charset = "utf-8" /> <!--<meta name = "format-detection" --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" /> <script src="modernizr.custom.86871.js"></script> <script type="text/javascript"> // function canvas-support () { // homecoming modernizr.canvas; // } function myfunction() { var thought = prompt("please come in thoughts"); // if (document.getelementbyid('fixed-size-square').clicked == true){ // var thought = prompt("please come in thoughts"); // } // else if (document.getelementbyid('size-square').clicked == true) { // var thought1 = prompt("please come in thoughts"); // } // else if (document.getelementbyid('square').clicked == true) { // var thought2 = prompt("please come in thoughts"); // } // else{ // return; // } var thought = document.getelementbyid('fixed-size-square'); var thought1 = document.getelementbyid('size-square'); var thought2 = document.getelementbyid('size'); if (thought) { var x = 50; var y = 150; var speed = 5; function gameloop(x,y,speed) { y += speed; x += speed; } } } </script> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <div> <canvas id="mycanvas"></canvas> </div> </div> <!--<p id = "demo"></p>--> <div class="fixed-size-square" onclick="myfunction()"> <span>past thoughts</span> </div> <div class="size-square" onclick="myfunction()"> <span>present thoughts</span> </div> <div class="square"onclick="myfunction()"> <span>future thoughts</span> </div> </div> <button>i've no thoughts</button> <script type="text/javascript"> var canvas = document.getelementbyid('mycanvas'); var context = canvas.getcontext('2d'); var centerx = canvas.width / 2; var centery = canvas.height / 2; var radius = 20; context.beginpath(); context.arc(centerx, centery, radius, 0, 2 * math.pi, false); context.fillstyle = 'red'; context.fill(); context.linewidth = 5; // context.strokestyle = '#003300'; // context.stroke(); </script> </body> </html>
javascript jquery html
Comments
Post a Comment