JavaScript
3
Вклад в тег
but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String vz = otv1.getText().toString();
int otv11 = Integer.parseInt(vz);
if (sum == otv11) {
txt3.setText("Правильно, вы угадали!");
im.setImageDrawable(getResources().getDrawable(R.drawable.fon1));
} else {
txt3.setText("Неправильно, правильный ответ: " + sum + ".");
im.setImageDrawable(getResources().getDrawable(R.drawable.fon2));
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Timer timer = new Timer("change");
Task task = new Task();
timer.schedule(task, 2000);
}
});
}
class Task extends TimerTask {
@Override
public void run() {
im.setImageDrawable(getResources().getDrawable(R.drawable.fon));
}
}
$('.first_div > img').each(function(i, elem) {
ref('.first_div > img', 0)
//console.log(lefted)
});
$('.sekond_div > img').each(function(i, elem) {
ref('.sekond_div > img', 0)
//console.log(lefted)
});
$('.sird_div > img').each(function(i, elem) {
ref('.sird_div > img',0)
//console.log(lefted)
});
});
function ref(name,itt){
itt++;
console.log(itt);
var lefted = -20 * itt;
$(name).eq(itt_3).css({
'left': lefted + 'px'
});
}