返回到:Prototype – 元素对象
此方法隐藏并返回元素。
语法
element.hide();
返回值
隐藏并返回 HTML 元素。
例子
HTML
x
29
29
1
<html>
2
<head>
3
<title>Prototype examples</title>
4
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
5
6
<script>
7
function hideElement() {
8
$('grandfather').hide();
9
}
10
function showElement() {
11
$('grandfather').show();
12
}
13
</script>
14
</head>
15
16
<body>
17
<p>Click the button to see the result.</p>
18
19
<div id = "grandfather" >This is grand father
20
<div id = "father"> This is father.
21
<div id = "kid" >This is kid</div>
22
</div>
23
</div>
24
<br />
25
26
<input type = "button" value = "Hide" onclick = "hideElement();"/>
27
<input type = "button" value = "Show" onclick = "showElement();"/>
28
</body>
29
</html>
返回到:Prototype – 元素对象
阅读剩余 80%
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/9089.html