
- 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 - 討論
Prototype - makePositioned() 方法
此方法透過將元素的 CSS 位置設定為 'relative'(如果其初始位置為 'static' 或未定義)輕鬆建立包含塊。CSS 位置設定為 'static'(如果其初始位置為 'static' 或未定義)
語法
element.makePositioned();
返回值
返回 HTML 元素。
示例
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function showResult() { $('container').makePositioned(); } </script> </head> <body> <p>Click the button to see the result.</p> <br /> <div id = "container"> <div id = "element" style = "position:absolute; top: 20px; left: 20px; border:1px solid red;"> This is Element Box </div> </div> <br /> <input type = "button" value = "Click" onclick = "showResult();"/> </body> </html>
輸出
prototype_element_object.htm
廣告