主题:yui-ext中多个超链接共用一个id问题
时间: 2020-08-27来源:ITEYE
前景提要
相关推荐: Dialog上放置Form实例 用Ext做的登陆窗口的例子 请教大家如何将页面的布局做成图2的那样?? YUI-EXT yui-ext基础入门(1) 《JavaScript凌厉开发--Ext详解与实践》一书说了些什么 初步搭建yui-ext(Ajax)的开发环境(后台->前台数据交换)
推荐群组: EXT
更多相关推荐
JavaScript EXT 大家好: 我使用多个链接共用一个id,如下: <c:forEach var="sSDIItem" items"${sSDIList}"> <c:if test="${(sSDIItem.grade==null)} <input type="hidden" name="stuAssignID" value="${sSDIItem.stuAssignID}"/> <a href="#" onclick="javascript:transStuAssignID('${sSDIItem.stuAssignID}'); return false;" id="show-dialog-btn">录入成绩</a> </c:if> </c:forEach> 然后在ext中调用: /* * Ext JS Library 1.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ // create the HelloWorld application (single instance) var enterGrade = function(){ // everything in this space is private and only accessible in the HelloWorld block // define some private variables var dialog, showBtn,postBtn; var wait,error,errorMsg; var grade,commentInfo; //var simple,grade,stuAssignID,commention; // return a public interface return { init : function(){ showBtn = Ext.get('show-dialog-btn'); wait = Ext.get('post-wait'); error = Ext.get('post-error'); errorMsg = Ext.get('post-error-msg'); Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'under'; grade = new Ext.form.TextField({ allowBlank:false, regex:/^\d+(\.\d+)?$/, regexText:'必须输入实数,如3,2.5等' }); grade.applyTo('grade'); commentInfo=new Ext.form.TextArea({ allowBlank:true, grow: true, preventScrollbars:true }); commentInfo.applyTo('comment'); /* simple = new Ext.form.Form({ labelWidth: 75, // label settings here cascade unless overridden url:'http://localhost:8080/WebAssignMIS/gradeManage.do?method=enterGrade' }); stuAssignID=new Ext.form.TextField({ fieldLabel: 'First Name', name: 'a', width:175, regex:/^\d+$/, regexText:'成绩必须为合法,如4或3.5等', allowBlank:false }); grade=new Ext.form.TextField({ fieldLabel: 'First Name', name: 'grade', width:175, regex:/^\d+$/, regexText:'成绩必须为合法,如4或3.5等', allowBlank:false }); commention=new Ext.form.TextField({ fieldLabel: 'Email', name: 'comment', vtype:'email', regexText:'电子邮件不合法', width:175 }); simple.add(stuAssignID,grade,commention); simple.addButton('确定',simple.submit,simple); simple.addButton('取消'); simple.render('form-ct'); */ // attach to click event showBtn.on('click', this.showDialog, this); }, // submit the comment to the server submitComment : function(){ wait.radioClass('active-msg'); if(grade.validate()===false) { wait.update('验证信息不合法'); return; } var commentSuccess = function(o){ postBtn.disable(); wait.update('录入成绩信息成功!'); document.location.reload(); }; var commentFailure = function(o){ postBtn.enable(); error.radioClass('active-msg'); errorMsg.update('不能连接服务器.....'); }; Ext.lib.Ajax.formRequest('comment-form', 'http://localhost:8080/WebAssignMIS/gradeManage.do?method=enterGrade', {success: commentSuccess, failure: commentFailure}); }, closeWindow : function(){ grade.reset(); commentInfo.reset(); dialog.hide(); }, showDialog : function(){ if(!dialog){ // lazy initialize the dialog and only create it once dialog = new Ext.BasicDialog("comments-dlg", { autoTabs:true, width:500, height:330, shadow:false, minWidth:500, minHeight:330, proxyDrag:true }); dialog.addKeyListener(27, dialog.hide, dialog); postBtn =dialog.addButton('确定', this.submitComment, dialog); dialog.addButton('关闭', this.closeWindow, dialog); dialog.on('hide', function(){ wait.removeClass('active-msg'); error.removeClass('active-msg'); }); } dialog.show(showBtn.dom); } }; }(); // using onDocumentReady instead of window.onload initializes the application // when the DOM is ready, without waiting for images and other resources to load Ext.EventManager.onDocumentReady(enterGrade.init, enterGrade, true); //Ext.onReady(HelloWorld.init, HelloWorld, true); 但是在点击超链接的时候(由于有多个超链接),点击第一个超链接时候能弹出窗口,后面的就不能了。 请各位帮忙看看 是这么回事,谢谢!

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行