ExtJS在传统模式、MVC模式下的使用区别

一、传统模式引用ExtJS

<link rel="Stylesheet" type="text/css" href="../../ExtJS/resources/css/ext-all.css" />
<link rel="Stylesheet" type="text/css" href="../../ExtJS/resources/css/xtheme-green.css" />
<script type="text/javascript" src="../../ExtJS/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ExtJS/ext-all.js"></script>

<script type="text/javascript">
	function newWin() {
		//alert('ok');
		var win = new Ext.Window({
			id: "MyProfile",
			title: "用户资料:弹出窗口",
			width: 800,
			height: 400,
			html: '<iframe id="frame_MyProfile" scrolling="auto" frameborder="0" width="100%" height="100%" src="User_View.aspx"></iframe>',
			maximizable: false,
			resizable: false,
			modal: true,
			listeners: {
				close: function (_this) {
					if (navigator.userAgent.indexOf("BIDU") > 0) {
						alert(window.frames["frame_MyProfile"].document.all("txt_OrderID2").value);
					}
					else if (navigator.userAgent.indexOf("Chrome") > 0 || navigator.userAgent.indexOf("Firefox") > 0) {
						alert(window.frames["frame_MyProfile"].contentWindow.document.getElementById("txt_OrderID2").value);
					}
					else {
						alert(window.frames["frame_MyProfile"].document.all("txt_OrderID2").value);
					}
				}
			},
		});
		win.show();
	}
	Ext.onReady(function () {
		Ext.get("btnWindow").on("click", newWin);
	});
</script>

<input id="btnWindow" type="button" value="弹出窗口" />


二、MVC模式下引用ExtJS

<link rel="Stylesheet" type="text/css" href="@Url.Content("~/ExtJS/resources/css/ext-all.css")" />
<link rel="Stylesheet" type="text/css" href="@Url.Content("~/ExtJS/resources/css/xtheme-green.css")" />
<script type="text/javascript" src="@Url.Content("~/ExtJS/adapter/ext/ext-base.js")"></script>
<script type="text/javascript" src="@Url.Content("~/ExtJS/ext-all.js")"></script>
<script type="text/javascript">
    function newWin() {
        var win = new Ext.Window({
            id: "MyProfile",
            title: "新增品牌:弹出窗口",
            width: 800,
            height: 400,
            html: '<iframe id="frame_MyProfile" scrolling="auto" frameborder="0" width="100%" height="100%" src="@Url.Content("~/Products/Add")"></iframe>',
            maximizable: false,
            resizable: false,
            modal: true,
        });
        win.show();
    }
</script>

<input type="button" name="ShowWin" value="弹出窗口" onclick="newWin()" />
 
 
这里仅列出其中两点,当然还有很多地方不一样。在实际应用中具体问题,具体分析。
 
 

你可能感兴趣的:(ExtJS在传统模式、MVC模式下的使用区别)