Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title></title>
- <link href="styles/js-console.css" rel="stylesheet" />
- </head>
- <body>
- <div id="js-console">
- <div>
- <label>Enter X: </label>
- <input type="text" id="xCoord"/>
- </div>
- <div>
- <label>Enter Y: </label>
- <input type="text" id="yCoord"/>
- </div>
- <div>
- <label>Check Position</label>
- <input type="button" Value="Check" onclick="CheckPosition()"/>
- </div>
- </div>
- <script src="scripts/js-console.js">
- </script>
- <script>
- function CheckPosition() {
- var x = jsConsole.readFloat("#xCoord");
- var y = jsConsole.readFloat("#yCoord");
- var isInCircle = ((x - 1)*(x - 1) + (y - 1)*(y - 1) < 9 ? true : false);
- var isOutRectangle = ((x > -1 && x < 5) && (y > -1 && y < 1) ? false : true);
- jsConsole.writeLine("The point" + (isInCircle && isOutRectangle ? " IS" : " IS NOT") +
- " within the circle K( (1,1), 3) and out of the rectangle R(top=1, left=-1, width=6, height=2).");
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement