css位置:
/*************对话框操作**********************/
body.dialog-shown {
filter: blur(25dip);
foreground-color:rgba(0,0,0,0.1);
transition: foreground-color(linear,400ms);
}
div.dialog-frame > caption{
padding:0 5dip;
color: #fff;
}
/* dialog "window" frame */
div.dialog-frame
{
position:absolute;
font: system;
width: 400dip;
height: 220dip;
min-width: min-content;
left: *;
right: *;
top: 0.4*;
bottom: 0.6*;
background: #fff;
outline:1dip solid #1FD0D9;
}
/* dialog body element */
div.dialog-frame > :nth-child(2)
{
height: *;
padding: 20dip;
vertical-align:middle;
text-align:center;
}
/* dialog button bar */
div.dialog-frame > text.buttons
{
margin:20dip 20dip 20dip *;
width: max-intrinsic;
white-space: nowrap;
flow:horizontal;
}
html位置:
脚本位置:
function dialog(params)
{
stdout.println("第一次进来1");
// init phase, build markup
var body = params.body || "Nothing to say, eh?";
stdout.println("赋值 body ="+body);
var body_html = "";
var caption;
if( body !instanceof Element )
{
stdout.println("第一次进来2");
body_html = "
stdout.println("出现按钮界面");
var html =
"
assert self.last.$is(div.dialog-frame);
var dlg = self.last; // our dialog layer
var prev_parent = null;
var prev_index;
stdout.println("出现按钮界面 2");
if( !body )
{
body = dlg.$(div.body); // if we've got dialog body as an html text
stdout.println("出现按钮界面 body ="+body);
}
else
{
// if we've got dialog body as a reference of existing Element
prev_parent = body.parent;
prev_index = body.nodeIndex;
dlg.insert(body,1); // insert it after the
// and finally run the modal loop: 最后运行模态循环:
body.state.expanded = true;
//view.update();
var docBody = $(body);
docBody.attributes.addClass("dialog-shown"); //添加名字
var sfocus = view.focus;
view.eventsRoot = dlg; //让界面无法其他操作
stdout.println("dlg = "+dlg);
while (dlg.isVisible && !body.state.collapsed && view.state != View.WINDOW_HIDDEN)
{
view.doEvent();
}
view.eventsRoot = null;
view.focus = sfocus;
if(prev_parent) //we were using existing DOM element so put it back
{
prev_parent.insert(body,prev_index);
}
dlg.remove(); // remove it from the DOM
docBody.attributes.removeClass("dialog-shown"); //删除名字
if(params.returns == #values && ret_val == #ok)
{
return body.value;
}
return ret_val;
}
调用:
// show the dialog:
var res = dialog { body:$(form#data-dialog),
returns: #values,
initial: { //有多个窗口输出再这里调用//initial:{#MyTest:MyText, #MyHtml:"第二个输出初始化", }}
#secret-wish:"I actually wanted the Sciter but got that .NET\nCan I finally get it? Santa, please!",
#gender :"male",
#birthday :new Date("1955-10-28"),
#last-name :"Gates",
#first-name :"Bill"
}
buttons: [ { caption: "Yep!", role:#ok, value:true },
{ caption: "Apply!", value: onApply },
{ caption: "No way!", role:#cancel, value:false } ]
};
列子再官方文档:sciter-sdk-master\samples\ideas\lightbox-dialog
sciter-sdk-master\samples\ideas\lightbox-dialog-doc-modal