Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  28] [ 2]  / answers: 1 / hits: 92540  / 10 Years ago, thu, february 27, 2014, 12:00:00

here is my code:



function figureSelector () {
document.getElementById(rook).onclick = function () {
curr = 'rook';
};
};

function moveLine(){
document.getElementById(upButton).onclick = function() {
document.getElementById(curr).style.top = document.getElementById(curr).offsetTop - getPix() * 62 + px;
counter= counter + getPix();
};


I want to write an universal function for a chess piece to move. All I want is, when one clicks the chess piece, and then presses the up button, it must go up.


More From » html

 Answers
5

Yes, you can.
Just use



curr = 'rook';


(without the extra quotes)


[#72268] Wednesday, February 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jadyngraysons

Total Points: 455
Total Questions: 109
Total Answers: 98

Location: Trinidad and Tobago
Member since Fri, May 8, 2020
4 Years ago
jadyngraysons questions
Thu, Apr 23, 20, 00:00, 4 Years ago
Sat, Jan 18, 20, 00:00, 4 Years ago
Tue, Dec 31, 19, 00:00, 4 Years ago
;