English 中文(简体)
嵌入 html 的 Javascript 不装入
原标题:Javascript embedded in html not loading

我试图设置的网站似乎没有加载 js。 我安装了json 和 php- pearar, 并重新启动了 apache 和 Whatnot 。 当我去到页面时, 我所看到的只是背景和横幅 。

<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>

我正在运行5号半人马5号

登录日志 :

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();
});
最佳回答

Turns out I hadn t uploaded the proper file (ext-base.js) Uploaded that and a few more dependencies and it worked perfectly. thanks for all the help though guys xD

问题回答

url () 语法是 CSS 所特有。 如果以 HTML 方式装入 JS, 它与 lt;img> 标签相同 。

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

这将假设登录。 js 位于与您页面相同的目录中 。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签