Click here to Skip to main content
15,889,839 members
Articles / Web Development / HTML

Creating a Code 39 Barcode using HTML, CSS and Javascript

Rate me:
Please Sign up or sign in to vote.
4.85/5 (24 votes)
14 Jan 2011GPL35 min read 317.8K   16.2K   58  
Creating a Code 39 Barcode using HTML, CSS and Javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Code39 Barcode</title>
    <script type="text/javascript" src="code39.js"></script>
    <style type="text/css">
  	#barcode {font-weight: normal; font-style: normal; line-height:normal; sans-serif; font-size: 12pt}
    </style>
</head>
<body>

Input : 123456<br />
Barcode : Code39<br />
Check Digit : 1 (On)<br /><br />

Output : <br /><br />

<div id="externalbox" style="width:5in">
<div id="inputdata" >123456</div>
</div>

<br />

<script type="text/javascript">
/* <![CDATA[ */
  function get_object(id) {
   var object = null;
   if (document.layers) {
    object = document.layers[id];
   } else if (document.all) {
    object = document.all[id];
   } else if (document.getElementById) {
    object = document.getElementById(id);
   }
   return object;
  }
get_object("inputdata").innerHTML=DrawCode39Barcode(get_object("inputdata").innerHTML,1);
/* ]]> */
</script>

</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Singapore Singapore
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions