|
以前用hl的时候,提交表单需要用aardio取数据再判断,现在配合sciter好像更好了。数据先在sciter那边的tis处理好了直接传json数据过来,这边只需要提交和跳转就行了。
提交的地址自己找合适的,我本地搭建自己调试自己的。
- //脚本调用本地函数
- import win.ui;
- /*DSG{{*/
- var winform = win.form(text="Sciter 脚本调用本地函数";right=320;bottom=240;border="none";parent=...)
- winform.add()
- /*}}*/
- import web.sciter;
- import console;
- import web.sciter.behavior.windowCommand;
- import web.rest.jsonLiteClient;
-
- http = web.rest.jsonLiteClient();
- var wbSciter = web.sciter( winform );
- import web.sciter.debug;
- wbSciter.attachEventHandler( web.sciter.debug );
- //调用本地函数,提交数据
- wbSciter.external = {
- scriptCallSubmit = function(scOwner,str){
- var str = http.post("http://api.jbp.com/admin/login/",str);
- console.debug(str);
- }
- }
- wbSciter.html =/***
- <!doctype html>
- <html>
- <head>
- <style>
- body{height: 100%;width: 100%;margin: 0px;padding: 0px;background:#fff;overflow:hidden;font-size:14px;}
- #header{behavior:windowCommand;width: 100%; height: 60px; background-color: #188AE2;}
- #header .logo{width: 100%; text-align: center;color:#fff;line-height:60px;font-size:16px;letter-spacing: 20px}
- #header .tool{width: 20px;position: absolute;top:0px;right: 0px;}
- .tool a[command]{display:inline-block; width:max-intrinsic;height:14px;font-family:"Marlett";font-size:14px;padding:4px;color:#fff;cursor:default;}
- .tool a[command]:hover{background:#6ebccf;}
- .tool a[command]:active{background:#FF0000;}
- .tool a[command="window-restore"]{content:"2";}
- #footer{width: 100%; height: 40px; padding: 5px; text-align: center;}
- #footer .btn{width: 50%;height: 18px;margin-bottom: 10px;}
- #bodyer{flow:" b c";padding: 5px;}
- #bodyer .reg{flow:vertical; width: 100px;float: "c";}
- #bodyer .from{width: *;height: *;float: "b";}
- .reg a{display: block; font-size: 12px; height: 30px; margin: 2px 10px 15px 5px; line-height: 30px;}
- .from .username,
- .from .password{border: 1px solid #ccc; margin: 2px 5px 15px 5px; width: *;display:block; padding: 0; height: 30px;position: relative;}
- .from .username:focus,.from .username:hover,
- .from .password:focus,.from .password:hover{border: 1px solid #66afe9;}
- .from .username input,
- .from .password input{max-width: 150px;vertical-align: top; height: 20px; font-size: 12px; line-height: 30px; padding: 5px; border-radius: 0; border-width: 0; }
- .from .username input:empty,
- .from .password input:empty{color: #999;}
- .from .text{margin: 0px 2px; color: #333; font-size: 12px; width: *;flow: horizontal;}
- .from .text label:nth-child(1){margin-right: 50px;}
- </style>
- <script type="text/tiscript">
- $(button#msg).onClick = function()
- {
- var msg = String.printf("%V", $(form).value ).replace("\t"," ");
- view.scriptCallSubmit(msg);
-
- }
- </script>
- </head>
- <body>
- <div id="header">
- <div class="logo">注册</div>
- <div class="tool"><a command="window-close" onclick="closeWindow()">r</a></div>
- </div>
-
- <form id="bodyer">
-
- <div class="from">
- <div class="username">
-
- <input name="user_name" type="text" class="input" novalue="账号/手机/邮箱" >
- </div>
- <div class="password">
-
- <input name="password" type="password" class="input" novalue="登录密码">
- </div>
- <div class="text">
- <label><input type="checkbox" name="remember"> 记住密码</label>
- <label><input type="checkbox" name="autologin"> 自动登录</label>
- </div>
- </div>
-
- <div class="reg">
- <a href="">注册帐号</a>
- <a href="#">忘记密码?</a>
- </div>
-
-
- </form>
- <div id="footer">
- <button class="btn btn-success" id="msg">登录</button>
- </div>
- </body>
- </html>
- ***/
- winform.show()
- win.loopMessage();
复制代码 |
|