I'm going out on a limb here , since your question was not very detailed, that
a) your receipt printer is a thermal printer that needs raw data,
b) that "from javascript" you are talking about printing from the web browser and
c) that you do not have access to send raw data from browser
Here is a Java Applet that solves all that for you , if I'm correct about those assumptions then you need either Java, Flash, or Silverlight
http://code.google.com/p/jzebra/