Board Logo

Little modification for TCPaint function
bizon-k - 4/4/2005 at 11:55 AM

Sorry for my English :-(

If you are choosing color (for example #33CCCC) and then modifying it to incorrect value in input field (for example #33JJKK or #rrrrrrr or 237654235) in attempt to open palette window once again you have a JS error in result.

To fix this "bug" ;-) i suggest the little modification of TCPaint function code:

function TCPaint(c, b_noPref) {
c = (b_noPref ? '' : '#') + c.toUpperCase();

// check correct color value with RegExp method
var ptrn = /^#[a-f0-9]{6}$/i;
if (!ptrn.test(c))
c = '#FFFFFF';


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/