Posts

Showing posts from June, 2022

Window Navigator

JavaScript The window.location object

Window Screen Properties

 <!DOCTYPE html> <html> <body> <p id="demo"></p> <p id="demo1"></p> <p id="demo2"></p> <p id="demo3"></p> <p id="demo4"></p> <p id="demo5"></p> <script> document.getElementById("demo").innerHTML =  " screen width is " + screen.Width; document.getElementById("demo1").innerHTML =  "Available screen width is " + screen.availWidth; document.getElementById("demo2").innerHTML =  " screen height is " + screen.height; document.getElementById("demo3").innerHTML =  "Available screen height is " + screen.availHeight; document.getElementById("demo4").innerHTML =  " screen Depth is " + screen.colorDepth; document.getElementById("demo5").innerHTML =  "screen pixelDepth is " + screen.pixelDepth; </script> </body> <...

Javascript Code to Create Drawing on HTML Canvas

<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="1000" height="500" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML canvas tag.</canvas> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.fillStyle="yellow"; ctx.fillRect(400,50,350,400); ctx.fill(); ctx.stroke(); ctx.beginPath(); ctx.fillStyle="black"; ctx.arc(500,150,50,0,2*Math.PI); ctx.stroke(); ctx.fill(); ctx.beginPath(); ctx.fillStyle="white"; ctx.arc(500,180,20,0,2*Math.PI); ctx.stroke(); ctx.fill(); ctx.beginPath(); ctx.fillStyle="black"; ctx.arc(650,150,50,0,2*Math.PI); ctx.stroke(); ctx.fill(); ctx.beginPath(); ctx.fillStyle="white"; ctx.arc(650,180,20,0,2*Math.PI); ctx.stroke(); ctx.fill(); ctx.beginPath(); ctx.fillStyle="black"; ctx.fillRect(550,250,30,40,40);  ctx.stroke(); ctx.fil...