<!DOCTYPE html>
<html>
<head>
<style>
.seth1color {
color: blue;
}
</style>
</head>
<body>
<h1>New Attr</h1>
<button onclick="SetAttr()">Create Attr</button><script type="text/JavaScript">
function SetAttr()
{
var attr = document.createAttribute("class");
attr.value = "seth1color";
var h1 = document.getElementsByTagName("H1")[0];
h1.setAttributeNode(attr);
}
/*
run:
New Attr
*/
</script></body>
</html>