Javascript code by Birger Nielsen to produce a 3 of 9 barcode using 2 images
(one a white pixel, the other a black pixel)
Rescued from
http://www.246.dk/code39.html
which has been taken down.
<script type="text/javascript">
<!--
{
barcode=prompt("String to transform into Code39","");
barcodeok = (barcode != null);
if (barcodeok) barcodeok = (barcode != "");
if (barcodeok) {
code = '*' + barcode + '*';
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 + 'caption' + g + '*' + barcode + '*' +
l + '/caption' + g + "\n";
l + 'tr' + g;
bcstr = "";
for (i = 0; i < code.length; i++) {
bc = "";
if (code.charAt(i) == ' ') { bc = '100011101011101';}
if (code.charAt(i) == '$') { bc = '100010001000101';}
if (code.charAt(i) == '%') { bc = '101000100010001';}
if (code.charAt(i) == '*') { bc = '100010111011101';}
if (code.charAt(i) == '+') { bc = '100010100010001';}
if (code.charAt(i) == '-') { bc = '100010101110111';}
if (code.charAt(i) == '.') { bc = '111000101011101';}
if (code.charAt(i) == '/') { bc = '100010001010001';}
if (code.charAt(i) == '0') { bc = '101000111011101';}
if (code.charAt(i) == '1') { bc = '111010001010111';}
if (code.charAt(i) == '2') { bc = '101110001010111';}
if (code.charAt(i) == '3') { bc = '111011100010101';}
if (code.charAt(i) == '4') { bc = '101000111010111';}
if (code.charAt(i) == '5') { bc = '111010001110101';}
if (code.charAt(i) == '6') { bc = '101110001110101';}
if (code.charAt(i) == '7') { bc = '101000101110111';}
if (code.charAt(i) == '8') { bc = '111010001011101';}
if (code.charAt(i) == '9') { bc = '101110001011101';}
if (code.charAt(i) == 'A') { bc = '111010100010111';}
if (code.charAt(i) == 'B') { bc = '101110100010111';}
if (code.charAt(i) == 'C') { bc = '111011101000101';}
if (code.charAt(i) == 'D') { bc = '101011100010111';}
if (code.charAt(i) == 'E') { bc = '111010111000101';}
if (code.charAt(i) == 'F') { bc = '101110111000101';}
if (code.charAt(i) == 'G') { bc = '101010001110111';}
if (code.charAt(i) == 'H') { bc = '111010100011101';}
if (code.charAt(i) == 'I') { bc = '101110100011101';}
if (code.charAt(i) == 'J') { bc = '101011100011101';}
if (code.charAt(i) == 'K') { bc = '111010101000111';}
if (code.charAt(i) == 'L') { bc = '101110101000111';}
if (code.charAt(i) == 'M') { bc = '111011101010001';}
if (code.charAt(i) == 'N') { bc = '101011101000111';}
if (code.charAt(i) == 'O') { bc = '111010111010001';}
if (code.charAt(i) == 'P') { bc = '101110111010001';}
if (code.charAt(i) == 'Q') { bc = '101010111000111';}
if (code.charAt(i) == 'R') { bc = '111010101110001';}
if (code.charAt(i) == 'S') { bc = '101110101110001';}
if (code.charAt(i) == 'T') { bc = '101011101110001';}
if (code.charAt(i) == 'U') { bc = '111000101010111';}
if (code.charAt(i) == 'V') { bc = '100011101010111';}
if (code.charAt(i) == 'W') { bc = '111000111010101';}
if (code.charAt(i) == 'X') { bc = '100010111010111';}
if (code.charAt(i) == 'Y') { bc = '111000101110101';}
if (code.charAt(i) == 'Z') { bc = '100011101110101';}
if (bcstr != "") {bcstr+="0";}
bcstr += bc;
}
for (i = 0; i < bcstr.length; i++) {
astr += l + 'td' + g + l + 'img src="http://www.246.dk/Pbc-' +
bcstr.charAt(i) + '.png" alt="' +
bcstr.charAt(i) + '"' + g + l + '/td' + g + "\n";
}
astr += l + '/tr' + g + "\n";
astr += l + '/table' + g + "\n" + l + '/body' + g + "\n" +l + '/html' + g + "\n";
aPopUp= window.open('','Barcode', 'toolbar=yes,menubar=yes,width=500,height=60');
ndoc= aPopUp.document;
ndoc.write(astr);
ndoc.close();
}
}
//-->
</script>
See also:
| file: /Techref/barcode/3of9.htm, 4KB, , updated: 2009/1/19 14:34, local time: 2010/9/2 22:08,
38.107.191.80:LOG IN
|
| ©2010 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? Please DO link to this page! Digg it! <A HREF="http://techref.massmind.org/techref/barcode/3of9.htm"> barcode, 3 of 9</A> |
| Did you find what you needed? |
|
Enter the PICList design contest to win a free PCB from olimex.com! |
|
Peter Todd has released source and sample projects for his artwork, including his 3d wireframe cube renderer for the PIC 18f6520 This includes examples of hardware developed with free software tools such as gEDA/gschem/PCB, SDCC, gputils and picp all on Linux. http://petertodd.ca/art/source-code/ |
.