Good afternoon, dear colleagues!
There is a small task, there is a javascript object
var obj = { up:function(id,type) { //Необходимо вернуть объект, вызвавший эту функцию } down:function(id,type) { //Тоже самое } }
And there are several objects on the page causing these actions, let's say:
<!--В начале страницы--> <div class="rating"> <i class="icon-plus" onClick="obj.up(1,'page')"></i> <b>0</b> <i class="icon-minus" onClick="obj.down(2,'page')"></i> </div> <!--В конце страницы--> <div class="rating"> <i class="icon-plus" onClick="obj.up(1,'page')"></i> <b>0</b> <i class="icon-minus" onClick="obj.down(2,'page')"></i> </div>
Well, accordingly, I need to get an object in the function that launched that function so that I could then change the value of <b> 0 </ b> in the block .rating in which the event occurred.
Do not tell me how best to implement?
obj.down(2,'page',this);
either hang up the handler using js instead ofonclick=""
this.nextSibling will be your elementb
- zb '26