拦截JS网页弹窗, 啧啧,还可以这样用

import win.ui;
import web.form
/*DSG{{*/
mainForm = win.form(text=”测试弹出框拦截”;right=642;bottom=464;border=”none”;maxmize=1;minmize=1;mode=”popup”;title=false)
mainForm.add(
static={cls=”static”;text=”static”;left=28;top=26;right=624;bottom=430;bgcolor=15780518;z=1}
)
/*}}*/

var html = /**
<!doctype html>
<html>
<head>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta http-equiv=”Content-Type” content=”textml; charset=UTF-8″ />
</head>
<body>
<h1> 会弹出消息框!</h1>
<script>
alert(“弹出来了!”);
</script>
</body>
<ml>
**/
string.save(“/main.html”,html);

import web.ui;
var mainWb = web.form( mainForm.static );
web.ui( mainWb );

mainWb.go(“/main.html”);

mainWb.showMsg = function(text/*信息*/,caption/*标题*/){
/*弹出对话框触发此事件*/

return true; /*返回false则不显示对话框*/
}

mainWb.showMsg = function(text,caption){
import console;
console.log(text);
return false;
}

mainForm.show()
return win.loopMessage();

发表评论

电子邮件地址不会被公开。 必填项已用*标注