日期:2014-05-16  浏览次数:20342 次

关于Ext框架使用
目前正在学习ExtJS框架,写了一个简单的例子,如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>  
    <title></title>  
   <link href="CSS/ext-all.css" rel="stylesheet" type="text/css" />   
   <script type="text/javascript" src="Scripts/ext-base.js" />
   <script type="text/javascript" src="Scripts/ext-all.js" />
    <script type="text/javascript">
        Ext.onReady(function () {
            var win = new Ext.Window(
            { title: "hello",
                width: 300,
                height: 200,
                html: '<h1>Hello,easyif open source</h1>'
            });

            win.show();
        });
    </script>  
</head>
<body></body>
</html>

注意: CSS/ext-all.css,Scripts/ext-base.js,Scripts/ext-all.js已经引用,版本是3.0的,开发环境用的是VS2010.
运行后发现:Microsoft JScript 运行时错误: 无法获取属性“_unload”的值: 对象为 null 或未定义

------解决方案--------------------
1、确保相关js引用准确无误
2、window里的对象参数要有id属性 这是常识
3、看你的代码 也没指定渲染到哪个dom元素上啊?

先自己试试吧 有问题把具体代码和错误晒出来再说~~
Ext.onReady(function () {
            var win = new Ext.Window(
            { title: "hello",
                id : "abc",
                renderTo : Ext.getBody(),
                width: 300,
                height: 200,
                html: '<h1>Hello,easyif open source</h1>'
            });

            win.show();
        });