HTML表单代码
<form class="card-body">
<div class="mb-3 input-group-lg">
<label for="input-qq" class="form-label">QQ号码</label>
<input type="text" id="input-qq" name="uin" class="form-control" placeholder="请输入要跳转的QQ号码" required>
</div>
<div class="row pt-2 pb-2">
<div class="col-12 col-md-4">
<button type="button" onClick="jumpToChat()" class="btn btn-primary btn-lg w-100">跳转聊天界面</button><br/><br/>
</div>
<div class="col-12 col-md-4">
<button type="button" onClick="jumpToAddFriend()" class="btn btn-primary btn-lg w-100">跳转加好友界面</button><br/><br/>
</div>
<div class="col-12 col-md-4">
<button type="button" onClick="jumpToWPA()" class="btn btn-primary btn-lg w-100">WPA临时会话</button>
</div>
</div>
</form>
JS提交函数
<script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.0.2/js/bootstrap.min.js"></script>
<script>
function jumpToChat() {
var qq = document.getElementById("input-qq").value;
var url = "mqqwpa://im/chat?chat_type=wpa&version=1&src_type=web&web_src=oicqzone.com&uin=" + qq;
window.location.href = url;
}
function jumpToAddFriend() {
var qq = document.getElementById("input-qq").value;
var url = "mqq://card/show_pslcard?src_type=internal&version=1&uin=" + qq + "&card_type=person&source=sharecard";
window.location.href = url;
}
function jumpToWPA() {
var qq = document.getElementById("input-qq").value;
var url = "https://wpa.qq.com/msgrd?v=3&site=qq&menu=yes&uin=" + qq;
window.open(url, '_blank');
}
</script>