Jump to content

Not really sure why this is not working


Jaws
 Share

Recommended Posts

Kinda new to java and this website ofc.Been doing a few exercises and i am not sure why this is not working :(Help much appreciated Edit: forgot to add that i am trying to make the program check what number it is and then bring up a alert box with 1 of 2 outcomes

body><canvas id="canvas1" width="640" height="480" ></canvas> <script type="text/javascript">    // turn the html5 canvas into something we can edit in javascript (call it myCanvas)...  var myCanvas = (document.getElementById("canvas1"));     // take a 2d context from the canvas (call it myContext)...  var myContext = (myCanvas.getContext("2d"));   // when we do drawing stuff, we do it to the context, not the canvas...  myContext.strokeRect(0,0,640,480);    myContext.fillText("hello", 20, 20);    function myFunction()   var n = 6;   if (n <= 5)  {  alert ("Yes");  }  else  {  alert ("NO");  }     </script> <input type="button" onclick="myFunction()" value="Show alert box" /></body></html>

Edited by Jaws
Link to comment
Share on other sites

function (myFunction)()

did you mean this?

when in doubt, read the tutorials.http://www.w3schools.com/js/js_functions.asp and use your error console.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...