Kirl
07-06-2006, 08:16 PM
Hi, I'm having problems when trying to retrieve the individual numbers from a two number variable that is used in a function. Variable "Nr" is a two number value, I want to get the first number and declare it as row and the second number as col. I have placed the bit that is causing problems below.
function setColor( Nr )
{
nrString = "" + Nr; // I use this to convert Nr to a string, it works but what is common practise?
row = nrString.getCharAt( 1 );
col = nrString.getCharAt( 2 );
alert( col );
}
What is going wrong here?
function setColor( Nr )
{
nrString = "" + Nr; // I use this to convert Nr to a string, it works but what is common practise?
row = nrString.getCharAt( 1 );
col = nrString.getCharAt( 2 );
alert( col );
}
What is going wrong here?