这是我的javascript代码
<script type="text/javascript">
Alert.render('Saved!','myurl.php');
</script>
并且渲染功能是
function CustomAlert() {
this.render = function (dialog,url) {
var winW = window.innerWidth;
var winH = window.innerHeight;
var dialogoverlay = document.getElementById('dialogoverlay');
var dialogbox = document.getElementById('dialogbox');
dialogoverlay.style.display = "block";
dialogoverlay.style.height = winH + "px";
dialogbox.style.left = (winW / 2) - (550 * 0.5) + "px";
dialogbox.style.top = "100px";
dialogbox.style.display = "block";
document.getElementById('dialogboxhead').innerHTML = "Heading";
document.getElementById('dialogboxbody').innerHTML = dialog;
document.getElementById('dialogboxfoot').innerHTML = "<button class='btn btn-info' onclick='Alert.ok(\"" + url + "\")'>OK</button>";
}
this.ok = function (url) {
window.location.href(url);
document.getElementById('dialogbox').style.display = "none";
document.getElementById('dialogoverlay').style.display = "none";
}
}
var Alert = new CustomAlert();
我的问题是,点击“确定”后页面没有重定向。按钮。请帮帮我??
答案 0 :(得分:2)
window.location.href
不是函数
将window.location.href(url);
更改为window.location.href = url;
答案 1 :(得分:0)
更改
onclick='Alert.ok(\"" + url + "\")'>
到
onclick='this.ok(\"" + url + "\")'>
因为在CustomAlert