返回到:Prototype – 元素对象
此方法返回元素的面向调试的字符串表示形式。Prototype 为许多类型提供检查方法,包括内置的和库定义的,例如 String、Array、Enumerable 和 Hash,它们试图为它们各自的类型提供最有用的字符串表示。
- undefined和null就是这样表示的。
- 查找其他类型以查找检查方法:如果有,则使用它,否则,它恢复为toString方法。
语法
element.inspect();
返回值
插入内容后返回 HTML 元素。
例子
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var str = $('golden-delicious').inspect();
alert("$('golden-delicious').inspect(): " + str );
var str = $('mutsu').inspect();
alert("$('mutsu').inspect() : " + str );
var str = $('mutsu').next().inspect();
alert("$('mutsu').next().inspect() : " + str );
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<ul>
<li id = "golden-delicious">Golden Delicious</li>
<li id = "mutsu" class = "yummy apple">Mutsu</li>
<li id = "mcintosh" class = "yummy">McIntosh</li>
<li</li>
</ul>
<br />
<input type = "button" value = "Click" onclick = "showResult();"/>
</body>
</html>返回到:Prototype – 元素对象
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/9080.html
支付宝
微信