- Prototype 教程
- Prototype - 主頁
- Prototype - 簡短概述
- Prototype - 有用功能
- Prototype - 實用程式方法
- Prototype - 元素物件
- Prototype - 數字處理
- Prototype - 字串處理
- Prototype - 陣列處理
- Prototype - 雜湊處理
- Prototype - 基本物件
- Prototype - 模板化
- Prototype - 列舉
- Prototype - 事件處理
- Prototype - 表單管理
- Prototype - JSON 支援
- Prototype - AJAX 支援
- Prototype - 表達範圍
- Prototype - 週期性執行
- Prototype 有用資源
- Prototype - 快速指南
- Prototype - 有用資源
- Prototype - 討論
原型 - $F() 方法
$F() 函式返回任何欄位輸入控制元件的值,例如文字框或下拉列表。這是 Form.Element.getValue 的簡便別名。
該函式既可以將元素 ID 或元素物件本身作為引數。
語法
$F(element)
返回值
表單元素值。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function ShowValue() {
var value = $F('userName');
alert( 'Entred Value :' + value);
}
</script>
</head>
<body>
<p>Enter any value in the box and then click "Show Value"</p>
<form>
<input type = "text" id = "userName" value = "Madisetti, Praveen">
<br/>
<input type = "button" value = "Show Value" onclick = "ShowValue();"/>
</form>
</body>
</html>
輸出
prototype_utility_methods.htm
廣告