用css样式和脚本js结合打开链接

本文介绍了一个使用JavaScript实现的游戏模块中不同游戏类型通过弹窗打开的具体方法。包括检查游戏状态和登录状态,并根据不同游戏类型打开相应的游戏页面。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//open window
function openWindow(openUrl, openName, openWidth, openHeight, openLeft, openTop){
var url = openUrl;
var name = openName;
var width = openWidth;
var height = openHeight;
var left = (String(openLeft) == "" ? (window.screen.availWidth-10-openWidth)/2 : openLeft);
var top = (String(openTop) == "" ? (window.screen.availHeight-40-openHeight)/2 : openTop);
window.open(url, name, "depended=yes,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);

}


//open game

$(".open_opus, .open_pt, .open_sport, .open_keno, .open_slotgame").click(function(event){
//To determine whether the download
var obj = event.srcElement ? event.srcElement : event.target;
if(!$(obj).attr("down_type")) {
//To determine whether the login
//It's the test value, please obtain the conditions of AJAX function, and then delete this line 

open_type = $(this).attr("open_type");
switch(open_type){
case "pt":
if(checkGameState(2) && checkLogin()){
openWindow('/html/PTPage.html?gamecode=7bal', 'onlinept',1280,650,"",0);
}
break;
case "sport":
if(checkGameState(3)){
window.location.href="/html/sportbet.html";
}
break;
case "keno":
if(checkGameState(4) && checkLogin()){
openWindow("http://keno.gi899.com","onlinekeno",1280,650,"",0);
}
break;
case "slotgame":
if(checkGameState(2) && checkLogin()){
window.location.href="/html/slotgame.html";
}
break;
default:
return;
}


}
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值