我们需要看看Javascript中一个对象有什么方法/字段。
We need to see what methods/fields an object has in Javascript.
最满意答案
正如其他人所说,你可以使用Firebug,这将排除你对Firefox的担忧。 Chrome和Safari都有一个内置的开发者控制台,它具有与Firebug控制台几乎相同的界面,因此您的代码应该可以在这些浏览器中移植。 对于其他浏览器,有Firebug Lite 。
如果Firebug不是您的选择,请尝试这个简单的脚本:
function dump(obj) { var out = ''; for (var i in obj) { out += i + ": " + obj[i] + "\n"; } alert(out); // or, if you wanted to avoid alerts... var pre = document.createElement('pre'); pre.innerHTML = out; document.body.appendChild(pre) }我建议不要警告每个单独的财产:一些对象有很多属性,你会在那里点击“确定”,“确定”,“确定”,“哦...这是我所属的财产寻找”。
As the others said, you can use Firebug, and that will sort you out no worries on Firefox. Chrome & Safari both have a built-in developer console which has an almost identical interface to Firebug's console, so your code should be portable across those browsers. For other browsers, there's Firebug Lite.
If Firebug isn't an option for you, then try this simple script:
function dump(obj) { var out = ''; for (var i in obj) { out += i + ": " + obj[i] + "\n"; } alert(out); // or, if you wanted to avoid alerts... var pre = document.createElement('pre'); pre.innerHTML = out; document.body.appendChild(pre) }I'd recommend against alerting each individual property: some objects have a LOT of properties and you'll be there all day clicking "OK", "OK", "OK", "O... dammit that was the property I was looking for".
更多推荐
发布评论