Thursday, 26 January 2012

Reading attributes of Tag

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Location, Location, Location</title>
<script>
function showattribs() {
var e = document.getElementById("t");
var elemList = "";
 for (var element in e) {
 var attrib = e.getAttribute(element);
 elemList = elemList + element + ": " + attrib + "\n";
 }
alert(elemList);
}
</script>
</head>
<body>
<a onclick="return showattribs();" href="tahirkhalid.blogspot.com"
id="t">Tahir Khalid Site</a>
<script type="text/javascript">
</script>
</body>
</html>

No comments:

Post a Comment