1

我正在尝试设置的这个网站似乎没有加载 js。我已经安装了 json 和 php-pear 并重新启动了 apache 等等。当我进入页面时,我看到的只是背景和横幅。

<html>
<head>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all.js"></script>
<style type="text/css">
body
{
font-family: Arial, Verdana, sans-serif;
background-image: url(graphics/background_gradient.png);
background-repeat: repeat-x;
background-color: #374d5b;
margin: 0;
padding: 0 0 20px 0;
font-size: 13px;
color: #333;
text-align: center;
}
.root
{
width: 410px;
margin: 0 auto;
text-align: left;
background-color: #e6e6e6;
position: relative;
}

#header
{
background: #0e1d2f url(graphics/banner.png) no-repeat left;
height: 90px;
}
</style> 
</head>
<body>
    <div class="root">
        <div id="header"></div>
    </div>
    <script type="text/javascript" src="login.js"></script> 
</body>
</html>

我正在运行 CentOS 5

登录.js:

Ext.onReady(function(){
Ext.QuickTips.init(); 
var login = new Ext.FormPanel({ 
    labelWidth:80,
    url:'login.php', 
    frame:true, 
    title:'Please Login', 
    defaultType:'textfield',
monitorValid:true,
    items:[{ 
            fieldLabel:'Username', 
            name:'loginUsername', 
            allowBlank:false 
        },{ 
            fieldLabel:'Password', 
            name:'loginPassword', 
            inputType:'password', 
            allowBlank:false 
        }],

    buttons:[{ 
            text:'Login',
            formBind: true,  
            handler:function(){ 
                login.getForm().submit({ 
                    method:'POST', 
                    waitTitle:'Connecting', 
                    waitMsg:'Sending data...',
                    success:function(){ 
                        Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
                            if (btn == 'ok'){
                                var redirect = './panel.php'; 
                                window.location = redirect;
                            }
                       });
                    },
                    failure:function(form, action){ 
                        if(action.failureType == 'server'){ 
                            obj = Ext.util.JSON.decode(action.response.responseText); 
                            Ext.Msg.alert('Login Failed!', obj.errors.reason); 
                        }else{ 
                            Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText); 
                        } 
                        login.getForm().reset(); 
                    } 
                }); 
            } 
        }] 
});

var win = new Ext.Window({
    layout:'fit',
    width:300,
    height:150,
    closable: false,
    resizable: false,
    plain: true,
    border: false,
    items: [login]
});
win.show();
});
4

2 回答 2

2

url()语法特定于 CSS 。对于在 HTML 中加载 JS,它与<img>标签相同。

<script type="text/javascript" src="login.js"></script>

这将假设 login.js 与您的页面位于同一目录中。

于 2012-05-23T15:31:28.033 回答
-1

原来我没有上传正确的文件(ext-base.js)上传了那个和更多的依赖项,它工作得很好。感谢所有的帮助,尽管伙计们 xD

于 2012-05-27T21:17:55.300 回答