Javascript Notes: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
(New page: <pre> function showattrs(theObject) { var out="<pre>" for (var attr in theObject) { out+=attr+":"+ theObject[attr]+"\n" } out+="</pre>" var block = document.getElem...)
 
No edit summary
Line 1: Line 1:
<pre>
<pre>
function showattrs(theObject) {
function showattrs(theObject) {
   var out="<pre>"
   var out="&gt;pre&lt;"
   for (var attr in theObject) {
   for (var attr in theObject) {
       out+=attr+":"+ theObject[attr]+"\n"
       out+=attr+":"+ theObject[attr]+"\n"
   }
   }
   out+="</pre>"
   out+="%gt;/pre&lt;"
   
   
   var block = document.getElementById("showattrs")
   var block = document.getElementById("showattrs")

Revision as of 16:06, 23 June 2010

function showattrs(theObject) {
   var out=">pre<"
   for (var attr in theObject) {
      out+=attr+":"+ theObject[attr]+"\n"
   }
   out+="%gt;/pre<"
 
   var block = document.getElementById("showattrs")
   block.innerHTML=out
}