lichess.org
Donate

PGN wiever with C language

You can also use events for clicks, double click, hover... Use an array to store the information you need, and access and modify them by functions calling by reference.
@HumanDestroyer

Of course i did not understand your example, that - it is sure - could help me to comprehend better.

In order to say more about this discussion, i will post a piece of code that - it is again sure! - you will understand fully, especially for the reason that it is very simple.

CODE

<!-- I have a "chessboard" 8x8 in wich every td has an id -->

<button onclick="one()">1 e4 e5</button>
<button onclick="two()">2 Nf3 Nc6</button>

<script>

function one() {

var x = document.getElementById("e2");
x.innerHTML = "";
var x = document.getElementById("e4");
x.innerHTML = "♙";
var x = document.getElementById("e7");
x.innerHTML = "";
var x = document.getElementById("e5");
x.innerHTML = "♟";

}

</script>

<script>

function two () {

var x = document.getElementById("g1");
x.innerHTML = "";
var x = document.getElementById("f3");
x.innerHTML = "♘";
var x = document.getElementById("b8");
x.innerHTML = "";
var x = document.getElementById("c6");
x.innerHTML = "♞";

}

<script>

END

This sequence of instructions, the buttons, the functions, work well. But i repeat myself asking you now how to show to the video again 1 e4 e5 after have clicked the 2 Nf3 Nc6 button?

<body>

<table id="array" border="yes" width="400px" height="400px">

<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>

<script type="text/javascript" >

int [][] matrix = new int [2] [2]

</script>

</body>

How to explain to the file that the "new int" has to be represented in the "array" table????? :/
well maybe i have to study a bit human destroyer i greet you and thank you bye for now!
//create array
int [][] matrix = {{0,5},{3,2}};

//declare var
var element1;

element1 = matrix[0][1]; //Access to 5

<td>element1</td>

This topic has been archived and can no longer be replied to.