潮汐SDK不要点击主窗口页面



我正在尝试制作一个带有登录表单(index.html)和迷你控制面板(panel.html)的应用程序,但是当我尝试登录时,该应用程序仅显示通知,而不会重定向到面板.html页面。

这是我索引的代码.html

    <script type="text/javascript">
    function loginTrue() {
                  Ti.UI.currentWindow.setURL("app://panel.html");
    }
    function showNotify(title, message) {
                  var notification = Ti.Notification.createNotification({
                    'title': title || 'Sin Titulo',
                    'message': message || 'Sin mensaje',
                    'timeout': 10
                  });
                  notification.show();
                }
        </script>
        <script type="text/javascript">
        </script>
        <script type="text/python">
            import MySQLdb
            import os
            db = MySQLdb.connect(host="localhost",user="root", passwd="toor", db="db")
            cursor = db.cursor()
            def login():
                username= document.getElementById('usuario').value;
                passw= document.getElementById('contrasena').value;
                cursor.execute("SELECT * FROM usuarios WHERE userlUsuario='"+username+"' and userContrasena='"+passw+"'" )
                res = cursor.fetchone()
                if(res==None):
                    showNotify("Error!", "Datos Invalidos, intente de nuevo.");
                else:
                    showNotify("Acceso!", "Login Correcto!");
                    loginTrue();
        </script>
<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="css/style.css" media="all" />
</head>
<body class="login">
    <div class="login">
        <section id="login">
            <h1><strong>Login</strong></h1>
            <form method="link">
                <input id="usuario" type="text" placeholder="Usuario" />
                <input id="contrasena" type="password" placeholder="Contraseña" />
                <button class="blue" onclick="login()">Entrar</button>
            </form>
        </section>
    </div>
</body>
</html>

我找到了它,问题出在登录表单上,当有人单击提交按钮时,它会自行将页面重定向到它,我解决了它添加"javascript:void(0);"作为表单的操作。

<form action="javascript:void(0);">

最新更新