Create an object and add attributes
<html> <head> <title>The Delete Operator</title> <script type = "text/javascript" > var aObject = {}; aObject["A"] = new Object; aObject["B"] = new Object; aObject["C"] = new Object; aObject["D"] = new Object; aObject["A"].myValue = "a"; aObject["B"].myValue = "b"; aObject["C"].myValue = "c"; aObject["D"].myValue = "d"; </script> </head> <body id = "mainbody"> <script type = "text/javascript"> for (obj in aObject) { var para = document.createElement('p'); para.id = obj; para.appendChild(document.createTextNode(obj + ": " + aObject[obj].myValue)); document.getElementsByTagName("body")[0].appendChild(para); } </script> </body> </html>