Javascript code by Birger Nielsen to produce a Code 128 barcode using 2 images
(one a white pixel, the other a black pixel)
Rescued from
http://www.246.dk/code128.html
which has been taken down.
<script type="text/javascript"> <!-- { value = new Array( ' ','!','"','#','$','%', '&',"'",'(',')','*','+', ',','-','.','/','0','1', '2','3','4','5','6','7', '8','9',':',';','<','=', '>','?','@','A','B','C', 'D','E','F','G','H','I', 'J','K','L','M','N','O', 'P','Q','R','S','T','U', 'V','W','X','Y','Z','[', '\\',']','^','_','`','a', 'b','c','d','e','f','g', 'h','i','j','k','l','m', 'n','o','p','q','r','s', 't','u','v','w','x','y', 'z','{','|','}','~','DEL', 'FNC3', 'FNC2', 'SHIFT', 'CODE C', 'FNC4' , 'CODE A', 'FNC1' ); code128 = new Array( '212222','222122','222221','121223','121322','131222', '122213','122312','132212','221213','221312','231212', '112232','122132','122231','113222','123122','123221', '223211','221132','221231','213212','223112','312131', '311222','321122','321221','312212','312212','322112', '322211','212123','232121','111323','131123','131321', '112313','132113','132311','211313','231113','231311', '112133','112331','132131','113123','113321','133121', '313121','211331','231131','213113','213311','213131', '311123','311321','331121','312113','312311','332111', '314111','221411','431111','111224','111422','121124', '121421','141122','141221','112214','112412','122114', '122411','142112','142211','241211','221114','413111', '241112','134111','111242','121142','121241','114212', '124112','124211','411212','421112','421211','212141', '214121','412121','111143','111341','131141','114113', '114311','411113','411311','113141','114131','311141', '411131' ) barcode=prompt("String to transform into Code128",""); barcodeok = (barcode != null); if (barcodeok) barcodeok = (barcode != ""); if (barcodeok) { chksum = 104; code = barcode; m = 1; for (i = 0; i < barcode.length; i++) { v = -1; for (j = 0; j < value.length; j++) { if (value[j] == barcode.charAt(i)) { v = j; } } chksum += m * v; m++; } chksum = chksum % 103; barcode = barcode + value[chksum]; wstr = ""; for (i = 0; i < barcode.length; i++) { v = -1; for (j = 0; j < value.length; j++) { if (value[j] == barcode.charAt(i)) { v = j; } } wstr += code128[v]; } wstr = "211214" + wstr + "2331112"; l = "\x3C"; g = "\x3E"; astr = l + 'html' + g + "\n" + l + 'head' + g + "\n" + l + 'title' + g + code + l + '/title' + g + "\n" + l + '/head' + g + "\n"; astr += l + 'body' + g + "\n"; astr += l + 'table border=0 cellspacing=0 cellpadding=0' + g + "\n" + l + 'tr' + g; for (i = 0; i < wstr.length; i++) { for (j = 0; j < wstr.charAt(i); j++) { astr += l + 'td' + g + l + 'img src="http://www.246.dk/Pbc-' + (1 - i%2) + '.png" alt="' + (1 - i%2) + '"' + g + l + '/td' + g + "\n"; } } astr += l + '/tr' + g + "\n"; astr += l + 'caption' + g + code + l + '/caption' + g + "\n"; astr += l + '/table' + g + "\n" + l + '/body' + g + "\n" + l + '/html' + g + "\n"; aPopUp= window.open('','code', 'toolbar=yes,menubar=yes,width=500,height=60'); aPopUp.document.write(astr); aPopUp.document.close(); } } // --> </script>
file: /Techref/barcode/code128.htm, 3KB, , updated: 2009/1/19 12:25, local time: 2024/11/22 19:52,
18.117.158.10:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/barcode/code128.htm"> Barcode, code128</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.