<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<div style="width:230px;margin-top:10px;"></div>
<div style="width:19px;float:left; height:19px;margin-left:5px;margin-top:3px;cursorointer;background: url('/images/color/black.gif');" onClick="getcolor('/catalog/img_loader/im/123701_man_black',123701);"></div>
<div style="width:19px;float:left; height:19px;margin-left:5px;margin-top:3px;cursorointer;background: url('/images/color/blue.gif');" onClick="getcolor('/catalog/img_loader/im/123701_man_blue',123701);"></div>
<script>
var a = document.getElementsByTagName('div'),
s = [];
for (var i = 0; i < a.length; i++) {
if (a[i].style.background) {
var tmp = a[i].style.background.match( /url\s*\([^)]*?([a-z]*)\.gif/ );
// var tmp = a[i].style.background.match( /\b([a-z]*)\.gif/ ); // как вариант чуть попроще
if( tmp ) s.push( tmp[1] )
}
}
document.write(s.join("<br>"))
</script>
</body>
</html>