Prototype - identify() 方法
此方法返回元素的 id 属性(如果存在),或设置并返回唯一的自动生成的 id。
语法
element.identify();
返回值
返回 HTML 元素 ID。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var str = $('apple').identify();
alert("Apple's ID: " + str );
var str = $('apple').next().identify()
alert("Orange's ID: " + str );
}
</script>
</head>
<body>
<p>单击按钮查看结果。</p>
<ul>
<li id = "apple">apple</li>
<li>orange</li>
</ul>
<br />
<input type = "button" value = "Click" onclick = "showResult();"/>
</body>
</html>

prototype_element_object.html