Returns the value of the title attribute

Description

title returns the value of the title attribute.

Example


<!DOCTYPE HTML>
<html>
<head>
<style title="core styles">
p {<!--from   www.j ava 2  s.c  o m-->
  border: medium double black;
  background-color: lightgray;
}

#block1 {
  color: white;
}
</style>
<link rel="stylesheet" type="text/css" href="styles.css" />
<style media="screen AND (min-width:500px)" type="text/css">
#block2 {
  color: yellow;
  font-style: italic
}
</style>
</head>
<body>
  <p id="block1">This is a test.</p>
  <p id="block2">This is a test.</p>
  <div id="placeholder" />
  <script>
    var placeholder = document.getElementById("placeholder");
    var sheets = document.styleSheets;
    for ( var i = 0; i < sheets.length; i++) {
      var newElem = document.createElement("table");
      newElem.setAttribute("border", "1");
      newElem.innerHTML += "<tr><td>index:</td><td>" + i + "</td></tr>";
      newElem.innerHTML += "<tr><td>title:</td><td>" + sheets[i].title + "</td></tr>";

      placeholder.appendChild(newElem);
    }
    function addRow(elem, header, value) {
      
    }
  </script>
</body>
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window