<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transition al.dtd"> <html xmlns="http://www./1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>JSOV - JavaScript Object Viewer</title> <meta name="robots" content="follow,index"> <style type="text/css"> body { font-family: Verdana, Tahoma, Arial; font-size: 12px; } div { display: inline; } a,a:link,a:hover { text-decoration: none; color:blue; } .o_prop_name { font-weight: bold; color: blue; font-size: 14px; } .o_prop_value { font-weight: bold; color: green; } </style> <script language="javascript" type="text/javascript"> /* appName: JSOV 1.0 beta Author: Billy Chow E-mail: billychow#tom.com Edited: 6:54 PM, 7/6/2006 */ function showObj() { var obj = eval(document.getElementById("txtObj").value); var str = ‘<div class="formated">‘; for (prop in obj) { str += ‘<div class="o_prop_name"><a href="#" title="next" onClick="changeObj(this.innerHTML)">‘+prop+ ‘</ a></div> = <div class="o_prop_value">‘ +obj[prop]+ ‘</div><br />‘; } str += ‘</div>‘; document.getElementById("txt3").innerHTML = str; } function changeObj(txt) { document.getElementById("txtObj").value += ‘.‘+txt; showObj(); } function eraser() { var tmpstr = document.getElementById("txtObj").value; tmpstr=tmpstr.replace(/\.\w*$/ig,""); document.getElementById("txtObj").value=tmpstr; showObj(); } function dispVal() { alert(eval(document.getElementById("txtObj").value)); } </script></head><body> <h1>JavaScript Object Viewer 1.0 beta</h1> <div id="txt1"> Input your object name here: <input id="txtObj" value="window" onkeydown="" type="text"> <input id="btnSubmit" value="View" onclick="showObj();" type="button"> <input id="btnBack" value="Back" onclick="eraser();" type="button"> <input id="btnDisp" value="DispVal" onclick="dispVal();" type="button"> </div> <br> <div id="txt2">The Object has these attributes:</div> <hr noshade="noshade"> <div id="txt3"> </div> </body></html> |
|