Posts

Applying Styles and Colors in html canvas

  Applying Styles and Colors on Stroke The default color of the stroke is black and its thickness is one pixel. But, you can set the color and width of the stoke using the strokeStyle and lineWidth property respectivley.   The following example will draw an orange color line having 5 pixels width.   <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Setting Stroke Color and Width on the Canvas</title> <style>             canvas {                         border: 1px solid #000;             } </style> <script>     window.onload = function() {         var canvas = document.getElem...

How to use HTML 5 Canvas-Graphics Element

What is Canvas? The HTML5 canvas element can be used to draw graphics on the webpage via JavaScript. The canvas was originally introduced by Apple for the Mac OS dashboard widgets and to power graphics in the Safari web browser. Later it was adopted by the Firefox, Google Chrome and Opera. Now the canvas is a part of the new HTML5 specification for next generation web technologies. By default the  <canvas>  element has 300px of width and 150px of height without any border and content. However, custom width and height can be defined using the CSS  height  and  width  property whereas the border can be applied using the CSS  border  property.   The anonymous function attached to the  window.onload event will execute when the page load. Once the page is loaded, we can access the canvas element with document.getElementById() method. Later we have defined a 2D canvas context by passing 2d into the getContext()...

PHP Programming 2 mark question and answers part2

  1) What is PHP? Answer:  PHP is one of the popular server-side scripting languages for developing a web application. The full form of PHP is Hypertext Preprocessor. It is used by embedding HTML for creating dynamic content, communicating with a database server, handling sessions, etc. 2) Why do we use PHP? Answer:  There are several benefits of using PHP. First of all, it is totally free to use. So anyone can use PHP without any cost and host the site at a minimal cost. It supports multiple databases. The most commonly used database is MySQL which is also free to use. Many PHP frameworks are used now for web development, such as CodeIgniter, CakePHP, Laravel, etc. These frameworks make the web development task much easier than before. 3) Is PHP a strongly typed language? Answer:  No. PHP is a weakly typed or loosely typed language. This means PHP does not require to declare data types of the variable when you declare any variable like the other st...