简体   繁体   English

ext.js是未定义的

[英]ext.js is undefined

In my aspx page: 在我的aspx页面中:

<script type="text/javascript">
Ext.onReady(function() {
    Ext.get('mb1').on('click', function(e) {
        Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
});
function showResult() {
    Ext.example.msg('test');
</script>

<div>
<asp:Button ID="mb1" runat="server" Text="Button" />
</div>

I got error message "ext is undefined". 我收到错误消息“ ext未定义”。 Can anyone help me? 谁能帮我?

You have to include the js file like 您必须包含js文件,例如

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

before using any of the functions. 在使用任何功能之前。

you should download the extjs framework from the site itself and host it locally if you can. 您应该从站点本身下载extjs框架,并在可能的情况下在本地托管。 http://extjs.com http://extjs.com

  1. Is it possible that you used " ext " somewhere instead of " Ext " (wrong capitalization)? 您是否可能在某个地方使用了“ ext ”而不是“ Ext ”(大小写错误)?
  2. you don't seem to be closing your functions with " } " 您似乎没有用“ } ”关闭函数

Once you get Ext working, you'll probably want to use the button's client ID instead of the code-behind ID: 一旦Ext开始工作,您可能需要使用按钮的客户端ID而不是代码隐藏ID:

...
Ext.get('<%=mb1.ClientID%>').on('click', function(e) {
...

在文件ext-all.css,ext-base.js,ext-all-debug.js中的所有三个文件下面包括

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM