JSFiddle - React, Tailwind, and code Playground
by kontrach
HTML
<table>
<tr id="Grafter">
<td>Первый</td>
<td>Столбец</td>
</tr>
<tr id="Thief">
<td>Второй</td>
<td>Столбец</td>
</tr>
</table>
<table>
<tr>
<td><button class="Result">Result</button></td>
<td><button class="Heal">Heal</button></td>
<td><button class="Shoot">Shoot</button></td>
</tr>
<tr>
<td colspan="3"><textarea></textarea></td>
</tr>
</table>
CSS
body{font-size:30px;}
JavaScript
var Players = {
Grafter: {
shoot:false,
heal:false,
stun:false
},
Thief:{
shoot:true,
heal:false,
stun:false
}
};
var Role = 'Grafter';
//$Role = toObject($Role);
alert(Players[Role].shoot);
var $To = 'Вор';
$(document).ready(function(){
/* $('button').click(function(){
$id = $(this).attr('class');
$id = $id.substring(6);
$('#' + $id).slideToggle();
});
*/
$('.Shoot').click(function(){
Players[Role].shoot = true;
});
$('.Heal').click(function(){
Players[Role].shoot = false;
});
$('.Result').click(function(){
alert(Players[Role].shoot);
// $('textarea').append($Role + ' применил действие на ' + $To);
});
});