如何设置元素是否由用户使用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 新婚迎宾海报祝福语简短
13 宝子生日祝福语简短
14 青春告白祖国简短祝福语
15 祖国生日祝福语简短英文
16 同事有趣祝福语大全简短
17 动心的生日祝福语简短
18 20岁简短生日祝福语