返回到:Prototype – 实用方法
$F() 函数返回任何字段输入控件的值,例如文本框或下拉列表。这是Form.Element.getValue的一个方便的别名。
该函数可以将元素 ID 或元素对象本身作为参数。
语法
$F(element)
返回值
表单的元素值。
例子
HTML
x
24
24
1
<html>
2
<head>
3
<title>Prototype examples</title>
4
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
5
6
<script>
7
function ShowValue() {
8
var value = $F('userName');
9
alert( 'Entred Value :' + value);
10
}
11
</script>
12
</head>
13
14
<body>
15
<p>Enter any value in the box and then click "Show Value"</p>
16
17
<form>
18
<input type = "text" id = "userName" value = "Madisetti, Praveen">
19
<br/>
20
<input type = "button" value = "Show Value" onclick = "ShowValue();"/>
21
</form>
22
23
</body>
24
</html>
返回到:Prototype – 实用方法
阅读剩余 77%
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/8951.html