- 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
广告