考试记不住
作者:互联网
今天考试不会所以写成博客加深一下印象
首先把表格的样式写出来
<style>
*{
font-family: "楷体";
font-size: 14px;
}
table,td{
border: 1px; solid: #ccc ;
border-collapse: collapse;
}
td,div,input{
width: 100px;
height: 20px;
text-align: left;
line-height: 20px;
}
div{
overflow: hidden;
text-overflow: ellipsis;
}
input{
height: 14px;
display: none;
border: 0px solid white;
}
</style>
然后写表格的代码
<table>
<tr>
<td>
<div>001</div>
<input type="text"/></td>
<td>张三</td>
</tr>
</table>
最后就是最重要的而且今天考试我还没记住的js代码
<script>
$(function () {
$("div").on("click",function () {
$(this).next(":input").val($(this).text()).show().select();
$(this).hide();
});
$(":input").blur(function () {
$(this).prev("div").text($(this).val()).show();
$(this).hide();
});
});
</script>
ok 这个昨天抄了一遍还是没记住今天写到博客上再来加深一下印象
标签:function,text,height,input,div,记不住,border,考试 来源: https://blog.csdn.net/ChengZiYa_/article/details/102732558