HTML部分
<table>
<tr>
<td class="d">
1231
</td>
<td class="a">
<input type="text" value="1">
</td>
<td class="b">
<input type="text" value="2">
<img src="" alt="">
</td>
<td class="c">
<table>
<tr>
<td>
<input type="text" value="3">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="data" value="是"> 是 <input type="checkbox" name="data" value="否"> 否
</td>
<td>
<input type="checkbox" name="time" value="22"><label for="">22</label>
<input type="checkbox" name="time" value="33"> 33
</td>
<td>
<table>
<tr>
<td>
<textarea name="" class="sss"></textarea>
</td>
</tr>
</table>
</td>
<td>
<label for="remmber" class="input-checkbox">
<input class="remmber" type="checkbox" name="remmber" id="remmber">
<span></span>
记住密码
</label>
<label for="radio" class="input-radio">
<input class="remmber" type="radio" name="rr" id="radio">
<span></span>
单选框
</label>
<label for="radio2" class="input-radio">
<input class="remmber" type="radio" name="rr" id="radio2">
<span></span>
单选框
</label>
</td>
<td></td>
</tr>
</table>
<button>123</button>
CSS部分
table input[type="text"] {
border: none;
background: none!important;
border-bottom: 1px solid #E0E3E4!important;
border-radius: 0;
}
table textarea {
border: none;
border-bottom: 1px solid #E0E3E4;
background: none;
}
table textarea.BigStatic1 {
background: none;
border: none;
border-bottom: 1px solid #e0e3e4;
}
table input.SmallButtonA {
background: #4D7AE5;
color: #fff;
border-radius: 0;
border: none;
margin-bottom: 10px;
height: 25px;
line-height: 25px;
}
table button.DATA{
background: url("oaimg/dataBtnImg.png") no-repeat;
height: 20px;
width: 23px;
border:none;
color: rgba(0,0,0,0);
overflow: hidden;
}
table button:focus{
outline: none;
}
table div[id^='LISTVIEW_DATA'] > span {
display: none;
}
table input.LIST_CAL {
display: none;
}
table .LIST_VIEW td,table .LIST_VIEW th {
border: 1px solid #aaa;
background: rgba(0,0,0,0)!important;
}
table tr.LIST_VIEW_HEADER {
height: 30px;
background: #F2F3F6;
color: #666;
}
table select {
border: none;
appearance:none;
-moz-appearance:none;
-webkit-appearance:none;
background: url("oaimg/arrow.png") no-repeat scroll right center transparent;
padding-right: 14px;
border-bottom: 1px solid #E0E3E4;
border-radius: 0;
}
table select::-ms-expand { display: none; }
table .remmber {
display: none;
}
table .remmber[type=checkbox]+span {
display: inline-block;
border-radius: 0;
width: 15px;
height: 15px;
color: #fff;
position: absolute;
top: 3px;
left: -20px;
background: #2ac845;
}
table .remmber[type=checkbox]:checked+span:after {
content: '\2714';
position: absolute;
font-size: 14px;
left: 2px;
top:-3px;
}
table .remmber[type=radio]+span {
display: inline-block;
border-radius: 100px;
width: 16px;
height: 16px;
position: absolute;
top: 3px;
left: -20px;
background: #2ac845;
}
table .remmber[type=radio]:checked+span:after {
content: '';
position: absolute;
font-size: 14px;
left: 50%;
top:50%;
margin-left: -4px;
margin-top: -4px;
width: 8px;
height: 8px;
border-radius: 100px;
background: #fff;
border: none;
}
table .input-checkbox,table .input-radio{
position: relative;
margin-left: 20px;
}
table input.ConcelBigInput,table textarea.ConcelBigInput{
background: none!important;
border-bottom: 1px solid #eee!important;
}
table input[readonly]{
border:none;
cursor: not-allowed;
}
.LIST_VIEW td input[type="button"]:first-child{
background: url("oaimg/addListImg.png") no-repeat!important;
height: 20px!important;
width: 23px!important;
border:none!important;
color: rgba(0,0,0,0)!important;
overflow: hidden!important;
}
.LIST_VIEW td input[value="删除"]:last-child{
background: url("oaimg/deleteListImg.png") no-repeat!important;
height: 20px!important;
width: 23px!important;
border:none!important;
color: rgba(0,0,0,0)!important;
overflow: hidden!important;
}
js部分
let inputArray = document.getElementsByTagName('input');
Array.prototype.slice.call(inputArray).map(ele => {
if(!ele.classList.contains('remmber') && ele.getAttribute('type') == 'checkbox') {
let name = ele.getAttribute('name'), value = ele.getAttribute('value'), text = '';
let parent = ele.parentElement;
if(ele.nextSibling.nodeType == '3') {
text = ele.nextSibling.nodeValue;
parent.removeChild(ele.nextSibling);
}
let newNode = document.createElement('label');
newNode.classList.add("input-checkbox");
newNode.innerHTML = '<input class="remmber" type="checkbox" name="' + name + ' value="' + value + '""><span></span>' + text;
parent.replaceChild(newNode, ele);
}
});