<script>
function copyToClip(content, message) {
var aux = document.createElement("input");
aux.setAttribute("value", content);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
if (message == null) {
alert("复制成功");
} else {
alert(message);
}
}
</script>
<table>
<tbody>
<tr>
<th>手机号</th>
<th></th>
<th>验证码</th>
<th></th>
</tr>
<tr>
<td>17166698316</td>
<td>
<button onclick="copyToClip('17166698316')"> 复制</button>
</td>
<td></td>
<td>
<button onclick="copyToClip('验证码1')"> 复制</button>
</td>
</tr>
<tr>
<td>12678330003</td>
<td>
<button onclick="copyToClip('12678330003')"> 复制</button>
</td>
<td></td>
<td>
<button onclick="copyToClip('验证码2')"> 复制</button>
</td>
</tr>
<tr>
<td>17752606470</td>
<td>复制</td>
<td></td>
<td>复制</td>
</tr>
<tr>
<td>12513732705</td>
<td>复制</td>
<td></td>
<td>复制</td>
</tr>
<tr>
<td>15187180446</td>
<td>复制</td>
<td></td>
<td>复制</td>
</tr>
<tr>
<td>18388829095</td>
<td>复制</td>
<td></td>
<td>复制</td>
</tr>
</tbody>
|