Monday, 16 December 2013

Tags of HTML 5-Part 3rd

(11)output:This tag represents the result of a calculation (like one performed by a script).

There are three attributes of this tag:-

(a)for :-Specifies the relationship between the result of the calculation, and the elements used in the calculation

(b)form :-Specifies one or more forms the output element belongs to

(c)name :-Specifies a name for the output element

Example:-

<!DOCTYPE html>
<html>
<body>

<form oninput="x.value=parseInt(a.value)">0
<input type="range" id="a" value="0">
100
=<output name="x" for="a"></output>
</form>

<p><strong>Note:</strong> The output tag is not supported in Internet Explorer.</p>

</body>
</html>
 

(12)canvas:This tag is used to draw graphics, on the fly, via scripting

And it is only a container for graphics, you must use a script to actually draw the graphics.

There are two attributes of this tag:-

 (a)height:Specifies the height of the canvas

 (b)width: Specifies the width of the canvas

Example:-

<!DOCTYPE HTML>
<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
    </style>
  </head>
  <body>
    <canvas id="myCanvas" width="578" height="400"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');
      var imageObj = new Image();

      imageObj.onload = function() {
        context.drawImage(imageObj, 69, 50);
      };
      imageObj.src = 'http://static5.businessinsider.com/image/51bf0defecad04a36800000c-960/new%20steve%20jobs%20cover.jpg';
    </script>
  </body>
</html>

(13)

No comments:

Post a Comment