<input type="text" placeholder="请输入邮箱">
<button>开始分析</button>
<div>
用户名:<span class="username"></span></br>
域名:<span class="domain"></span></br>
顶级域名:<span class="top-domain"></span>
</div>
<script type="text/javascript">
var arr = [{email:"xx@163.com",username:"zhangsan",domain:"hao123",topDomain:".com"},{email:"yy@qq.com",username:"lisi",domain:"baidu",topDomain:".com"},{email:"zz@msn.com",username:"wangwu",domain:"taobao",topDomain:".com"}]
var inp = document.getElementsByTagName("input")[0]
var btn = document.getElementsByTagName("button")[0]
var username = document.getElementsByClassName("username")[0]
var domain = document.getElementsByClassName("domain")[0]
var topDomain = document.getElementsByClassName("top-domain")[0]
btn.onclick = function() {
var val = inp.value
username.textContent = ""
domain.textContent = ""
topDomain.textContent = ""
for (var i=0i<arr.lengthi++) {
if (val == arr[i].email) {
username.textContent = arr[i].username
domain.textContent = arr[i].domain
topDomain.textContent = arr[i].topDomain
}
}
}
</script>
第一、把所有复选框的name改成一样的第二、(全选、反选)<script type="text/javascript">
//复选框全选
function checkAll(formvalue) {
var roomids = document.getElementsByName(formvalue)
for ( var j = 0j <roomids.lengthj++) {
if (roomids.item(j).checked == false) {
roomids.item(j).checked = true
}
}
}
//复选框全不选
function uncheckAll(formvalue) {
var roomids = document.getElementsByName(formvalue)
for ( var j = 0j <roomids.lengthj++) {
if (roomids.item(j).checked == true) {
roomids.item(j).checked = false
}
}
}
//复选框选择转换
function switchAll(formvalue) {
var roomids = document.getElementsByName(formvalue)
for ( var j = 0j <roomids.lengthj++) {
roomids.item(j).checked = !roomids.item(j).checked
}
}
</script>
第三、弹出新页面:<script>window.open(页面名)<script/>