如何设置元素是否由用户使用JavaScript调整大小?
使用resize属性设置元素是否可由用户调整大小。
示例
您可以尝试运行以下代码来设置元素是否可由用户使用JavaScript调整大小-
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 350px;
overflow: auto;
background-color: orange;
border: 3px solid red;
}
</style>
</head>
<body>
<p>Click to set the right position.</p>
<button type = "button" onclick = "display()"> Set Right Position </button>
<div id = "box">
<p>This is a div. This is a div. This is a div. This is a div.<p>
<p>This is a div. This is a div. This is a div. This is a div.<p>
<p>This is a div. This is a div. This is a div. This is a div.<p>
</div>
<br>
<br>
<script>
function display() {
document.getElementById("box").style.resize = "both";
}
</script>
</body>
</html>热门推荐
10 鱼的内涵简短祝福语
11 简短古文生日祝福语
12 出院祝福语简短8字
13 项目总生日祝福语简短
14 同事调动的祝福语简短
15 新婚祝福语简短十六字
16 孩子满月随礼简短祝福语
17 步入高中祝福语简短励志
18 简短新婚铺被子祝福语