Alan
Alan
var oLi = document.querySelectorAll('li') var input = document.querySelector('input') oLi.forEach(item => { item.addEventListener('click',function(){ let self = this; self.className = self.className.indexOf('selected') === -1 ? self.className += 'selected' : self.className; input.value = self.innerText;...
([demo](https://jsbin.com/sucunoyaxi/4/edit?html,css,output)) ``` css *{ margin: 0; padding: 0; } body{ background: #83c1ff; } ul{ list-style: none; display: grid; color: #fff; grid-template-columns: repeat(3, 33.33%); margin-right: -1px; margin-bottom: -1px; } img{ width:...
``` javascript // 第一题 strTel = strTel.trim() // 第二题 strTel = strTel.split('').map(item => { let temp = '' if (item.charCodeAt() === 12288) { temp += String.fromCharCode(item.charCodeAt() - 12256) } if...
[demo](https://jsbin.com/nutuqowigu/1/edit?html,js,output) ``` html 132-0803-3621 [email protected] ``` ``` javascript // 第一题 function telTrim (str) { let tel = str.replace(/[-\s]/g, ''); if (/^[0-9]{11}$/g.test(tel)) { return tel; } return str; } // 第二题...