论坛首页 入门讨论版 EXT

IE报语法错误

浏览 752 次
该帖已经被评为新手帖
作者 正文
最后更新时间:2008-04-15 关键字: ie报语法错误

我有两个页面,一个extlogin.jsp输入用户名和密码后经过后台验证跳转到extindex.jsp,但是在点击登陆提交FormPanel

后调试器报出一个语法错误,在ext-all.js的23行,我很难确定它想要说到底是哪里的语法有问题,以下是ext-all.js23行的源代码,

谢谢各位帮忙看看,这两个jsp在FireFox下是不会报错的,没有问题,在IE7下就会报这样的语法错误。

{width:w||this.getWidth(true),height:h||this.getHeight(true)}},getViewSize:function(){var d=this.dom,doc=document,aw=0,ah=0;if(d==doc||d==doc.body){return{width:D.getViewWidth(),height:D.getViewHeight()}}else{return{width:d.clientWidth,height:d.clientHeight}}},getValue:function(asNumber){return asNumber?parseInt(this.dom.value,10):this.dom.value},adjustWidth:function(width){if(typeof width=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){width-=(this.getBorderWidth("lr")+this.getPadding("lr"))}if(width<0){width=0}}return width},adjustHeight:function(height){if(typeof height=="number"){if(this.autoBoxAdjust&&!this.isBorderBox()){height-=(this.getBorderWidth("tb")+this.getPadding("tb"))}if(height<0){height=0}}return height},setWidth:function(width,animate){width=this.adjustWidth(width);if(!animate||!A){this.dom.style.width=this.addUnits(width)}else{this.anim({width:{to:width}},this.preanim(arguments,1))}return this},setHeight:function(height,animate){height=this.adjustHeight(height);if(!animate||!A){this.dom.style.height=this.addUnits(height)}else{this.anim({height:{to:height}},this.preanim(arguments,1))}return this},setSize:function(width,height,animate){if(typeof width=="object"){height=width.height;width=width.width}width=this.adjustWidth(width);height=this.adjustHeight(height);if(!animate||!A){this.dom.style.width=this.addUnits(width);this.dom.style.height=this.addUnits(height)}else{this.anim({width:{to:width},height:{to:height}},this.preanim(arguments,2))}return this},setBounds:function(x,y,width,height,animate){if(!animate||!A){this.setSize(width,height);this.setLocation(x,y)}else{width=this.adjustWidth(width);height=this.adjustHeight(height);this.anim({points:{to:[x,y]},width:{to:width},height:{to:height}},this.preanim(arguments,4),"motion")}return this},setRegion:function(region,animate){this.setBounds(region.left,region.top,region.right-region.left,region.bottom-region.top,this.preanim(arguments,1));return this},addListener:function(eventName,fn,scope,options){Ext.EventManager.on(this.dom,eventName,fn,scope||this,options)},removeListener:function(eventName,fn){Ext.EventManager.removeListener(this.dom,eventName,fn);return this},removeAllListeners:function(){E.purgeElement(this.dom);return this},relayEvent:function(eventName,observable){this.on(eventName,function(e){observable.fireEvent(eventName,e)})},setOpacity:function(opacity,animate){if(!animate||!A){var s=this.dom.style;if(Ext.isIE){s.zoom=1;s.filter=(s.filter||"").replace(/alpha\([^\)]*\)/gi,"")+(opacity==1?"":" alpha(opacity="+opacity*100+")")}else{s.opacity=opacity}}else{this.anim({opacity:{to:opacity}},this.preanim(arguments,1),null,0.35,"easeIn")}return this},getLeft:function(local){if(!local){return this.getX()}else{return parseInt(this.getStyle("left"),10)||0}},getRight:function(local){if(!local){return this.getX()+this.getWidth()}else{return(this.getLeft(true)+this.getWidth())||0}},getTop:function(local){if(!local){return this.getY()}else{return parseInt(this.getStyle("top"),10)||0}},getBottom:function(local){if(!local){return this.getY()+this.getHeight()}else{return(this.getTop(true)+this.getHeight())||0}},position:function(pos,zIndex,x,y){if(!pos){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}}else{this.setStyle("position",pos)}if(zIndex){this.setStyle("z-index",zIndex)}if(x!==undefined&&y!==undefined){this.setXY([x,y])}else{if(x!==undefined){this.setX(x)}else{if(y!==undefined){this.setY(y)}}}},clearPositioning:function(value)

 

 

下面是我的extlogin.jsp的源代码:

<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<html>
  <head>   
    <title>系统管理</title>
	<link rel="stylesheet" type="text/css" href="scripts/ext20/resources/css/ext-all.css"/>
	<script type="text/javascript" src="scripts/ext20/ext-base.js"></script>
	<script type="text/javascript" src="scripts/ext20/ext-all.js"></script>
	<script type="text/javascript" src="scripts/ext20/ext-lang-zh_CN.js"></script>
	<script type="text/javascript">
	var LoginPanel = function(){
    var win, f;
    var buildForm = function(){       
        f = new Ext.form.FormPanel({          
            bodyStyle:'padding-top:6px;',          
            defaultType:'textfield',           
            labelAlign:'right',
            labelWidth:55,
            labelPad:0,
            frame:true,      
            defaults:{
                allowBlank:false,
                width:158
            },           
            items:[{                
                    cls:'user',                    
                    name:'j_username',                  
                    fieldLabel:'帐号',                    
                    blankText:'帐号不能为空'
                },{
                    cls:'key',
                    name:'j_password',
                    fieldLabel:'密码',
                    blankText:'密码不能为空',
                    inputType:'password'
                },{
                	cls:'key',
                	name:'j_uri',
                	fieldLabel:'验证码',
                	blankText:'验证码不能为空'
                },{
                	xtype:'panel',
                	hideLabel:true,
                	bodyStyle:'algin:right;',
                	name:'codepanel',
                	width:300,
                	html:'<img id="verifyCode" src="verify.mm"/>'
                },{
                	xtype:'hidden',
                	hideLabel:true,
                	id:'appidext',
                	name: 'appidext',
                	value:'1'            	
                }]
        });
    };
    var buildWin = function(){
        win = new Ext.Window({           
            el:'win',            
            title:'登陆系统',           
            width:265,            
            height:180,           
            layout:'column',           
            collapsible:true,
            defaults:{               
                border:false
            },
            items:{
                columnWidth:1,          
                items:f
            },          
            buttonAlign:'center',       
            buttons:[{               
                    text:'登陆',                   
                    handler:login
                },{
                    text:'重置',
                    handler:reset
                }]
        });
    };
    var login = function(){
        f.form.submit({
			waitMsg:'正在登陆',
			url:'authorize',
			method:'POST',
			success:function(form,action){
				window.location.href='extindex.jsp';
			},
			failure:function(form,action){
				if (action.failureType == Ext.form.Action.SERVER_INVALID)
					Ext.MessageBox.alert('警告', action.result.errors.msg);
			}
            });
            
    };
    var reset = function() {
        f.form.reset();
    };   
    return {
        init:function() {
            buildForm();
            buildWin();
            win.show();
        }
    }
}();
	Ext.onReady(LoginPanel.init, LoginPanel);
	</script>
  </head> 
  <body>
    <div id='win'></div>
  </body>
</html>

 

下面是extindex.jsp的源代码:

<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<html>
  <head>  
    <title>系统管理</title>
	<link rel="stylesheet" type="text/css" href="scripts/ext20/resources/css/ext-all.css" />
	<script type="text/javascript" src="scripts/ext20/ext-base.js"></script>
	<script type="text/javascript" src="scripts/ext20/ext-all.js"></script>
	<script type="text/javascript" src="scripts/ext20/ext-lang-zh_CN.js"></script>
	<script type="text/javascript">
		Ext.onReady(function() {
		var viewport = new Ext.Viewport({    
			layout:'border',    
			items:[{          
				region: 'north',        
				contentEl: 'north-div',        
				split: true,        
				border: true,        
				collapsible: true,        
				height: 50,        
				minSize: 50,        
				maxSize: 120    
			},{        
				title: '菜单树',        
				region: 'west',        
				contentEl: 'west-div',        
				split: true,        
				border: true,        
				collapsible: true,        
				width: 150,        
				minSize: 120,        
				maxSize: 200,
				items: [   
               {   
                    autoScroll:true,   
                    border:false,   
                    iconCls:'nav',   
                    html:'<div id="tree-viewer" style="overflow:auto;height:400px;border:0px solid #c3daf9;"></div>'  
                   }   
				] 
			},{        
				title: '内容',        
				region: 'center',        
				contentEl: 'center-div',        
				split: true,        
				border: true,        
				collapsible: true, 
				html:'<iframe id="center-div" style="overflow:auto;height:400px;border:0px solid #c3daf9;"></iframe>' 
			}]});
			var Tree = Ext.tree;   
    		tree = new Ext.tree.TreePanel({   
        		el:'tree-viewer',   
        		autoScroll:true,   
        		animate:false,   
        		border: false,   
        		enableDD:true,   
        		containerScroll: true,   
        		rootVisible:true,   
        		loader: new Ext.tree.TreeLoader({      
            	dataUrl:'tree.do'  
        		})   
    		});  
    		root = new Ext.tree.AsyncTreeNode({   
        		text: 'root',   
        		draggable:false,   
        		id:'source'  
    		});   
    		tree.setRootNode(root); 
    		tree.render();   
    		root.expand();       
      		tree.on('click', function (node){
      			if(node.isLeaf()){   
         		 Ext.get('center-div').dom.src = node.attributes.src;  
          		return true;  
      			}else{  
         			node.toggle();  
         		}
      		});
    		
});		
	</script>
  </head>
  
  <body>
    <div id="north-div"></div>
    <div id="west-div"></div>
    <div id="center-div"></div>
  
  
  </body>
</html>
 

 

   
最后更新时间:2008-04-24
我也碰到一个脚本错误,和楼主差不多,报的是参数无效,跟了一下是width得到一个NaN的值,在ext-all-debug.js 的这段中的这行报错:
行:this.dom.style.width = this.addUnits(width);
段:setWidth : function(width, animate){
        width = this.adjustWidth(width);
        if(!animate || !A){
            this.dom.style.width = this.addUnits(width);
        }else{
            this.anim({width: {to: width}}, this.preanim(arguments, 1));
        }
        return this;
    },
   
0 请登录后投票
最后更新时间:2008-07-06
老大,最后怎么解决的呀,我也是遇到这样的问题,在TeePanel的click事件中,不能使用Ext.Message.confirm和Ext.window,不然,就关闭弹出的窗口后,就报"无效参数"。
如下图中,点击logout后,弹出确认框,这里都没有问题,但无论是点YES还是No,都报错"无效参数"。
  • 2097d7b5-e9f3-3046-8517-5468a264f348-thumb
  • 大小: 32.3 KB
   
0 请登录后投票
最后更新时间:2008-07-08
没有遇到这个问题吗?
   
0 请登录后投票
最后更新时间:2008-09-09
我也遇到这个问题 ,主要解决是nan的问题,我的主要产生nan的问题是panel.height 这个属性得到nan  我最后使用panel.getSize()['height'] 来获得高度
   
0 请登录后投票
论坛首页 入门讨论版 EXT

跳转论坛:
JavaEye推荐