一键切换,随机拨打双号码

代码如下:

<!DOCTYPE html>    
<html lang="en">    
<head>    
<meta charset="UTF-8">    
<meta name="viewport" content="width=device-width, initial-scale=1.0">    
<title>随机拨打电话</title>    
<style>    
body {    
font-family: Arial, sans-serif;    
display: flex;    
justify-content: center;    
align-items: center;    
height: 100vh;    
margin: 0;    
background-color: #f0f0f0;    
}    
.container {    
text-align: center;    
}    
.call-button {    
background-color: #4CAF50;    
color: white;    
padding: 10px 20px;    
text-align: center;    
text-decoration: none;    
display: inline-block;    
font-size: 16px;    
border-radius: 5px;    
cursor: pointer;    
}    
</style>    
</head>    
<body>    
<div class="container">    
<h1>随机拨打电话</h1>    
<button class="call-button" onclick="randomCall()">点击拨打电话</button>    
</div>    
<script>    
function randomCall() {    
const phoneNumbers = ["1234567890", "0987654321"]; // 定义两个电话号码    
const randomIndex = Math.floor(Math.random() * phoneNumbers.length); // 随机选择一个索引    
const selectedNumber = phoneNumbers[randomIndex]; // 获取随机选择的电话号码    
window.location.href = 'tel:' + selectedNumber; // 调用拨号功能    
}    
</script>    
</body>    
</html>


1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
川芎模板网 » 一键切换,随机拨打双号码

发表评论

加载中~

加入本站VIP会员订阅计划,海量资源免费查看

目前为止共有 3654 位优秀的VIP会员加入! 立刻加入VIP会员