View Full Version : Multiple button click event ,use extjs
qmj119
29 Jun 2007, 12:22 AM
<input type="button" id="'imgsubmit'" value="1" >
<input type="button" id="'imgsubmit'" value="2" >
i use extjs
Ext.onReady(function() {
Ext.get('imgsubmit').on('click', function(e)
{
var myvalue= Ext.get(e.target).dom.value
alert(myvalue);
});
}
);
why first one value is 1,but 2 is not alert.it is a array,how can i do?
liggett78
29 Jun 2007, 12:51 AM
What do you actually want to write? Just listing some tags or js isn't gonna help anyone here to understand your problem, if you don't express your intention. Please be more specific, otherwise you're just wasting people's time.
Animal
29 Jun 2007, 2:54 AM
IDs must be unique. Ext.get("id") only returns one element.
If you want >1, then use DomQuery and select by tag name or class name, or whatever other selector you want. See DomQuery docs.
trbot
29 Jun 2007, 6:21 AM
Not to mention your coding is full of holes.
1. src should be src='...' -- I don't know what you were trying to do with it there..
2. value is not closed in the second line
3. learn to indent and follow coding conventions / best practices. bad web-programmers are the scourge of the internet. the w3c and sun java coding conventions are a good place to start.
brian.moeskau
29 Jun 2007, 1:33 PM
Regarding #3 from trbot's comment, you'll want to use the CODE tags (the # button) in the forum post edit window to preserve your code indentation.
qmj119
30 Jun 2007, 10:53 PM
i read domquery doc,this question has already solved
test{}
test.myonclick=function(e){
Var e1=Ext.get(e).dom.vlaue
alert("this is ok"+e1);
}
<input type="button" name="button" value="1" onclick="test.myonclick(this)">
<input type="button" name="button" value="2" onclick="test.myonclick(this)">>
thanks erveryone!
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.