返回到:Prototype – 元素对象
此方法返回元素的 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>Click the button to see the result.</p>
<ul>
<li id = "apple">apple</li>
<li>orange</li>
</ul>
<br />
<input type = "button" value = "Click" onclick = "showResult();"/>
</body>
</html>返回到:Prototype – 元素对象
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/9086.html
支付宝
微信