个人面试所经历过的面试题
First
- 实现一个盒子固定在屏幕正中央的方法
<style>
.box {
width: 200px;
height: 200px;
background-color: red;
position: fixed;
left: 50%;
top: 50%;
margin-left: -100px;
margin-top: -100px;
}
body {
height: 2000px;
}
</style>
<body>
<div class="box"></div>
</body>
- 删除一个数组内指定的元素
答:indexOf 和 splice。 - 假设一个交互场景,如果要提交一个表单数据,需要怎么防止用户多次点击?
答:在用户点击提交按钮发送网络请求后,将按钮设置为禁用状态,等网络请求成功后再设置回来。