calling function in a .class file from javascript in HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • George Kurzhals
    New Member
    • Jul 2011
    • 1

    calling function in a .class file from javascript in HTML

    I have a Unit.class file that has various "handy" classes and functions that I want to use in a simple JavaScript in HTML. How do I reference unit.class so that I can use it? For example, I want to instantiate a Quantity variable and use its methods SetTo and GetAs:
    Code:
      <script type="text/javascript">
        <!--
        function Translate(UnitForm)
          {
          Quantity q = new Quantity( UnitForm.x.value );
          q.SetTo( UnitForm.y.value );
          return q.GetAs( UnitForm.z.value );
          }
        //-->
      </script>
    Last edited by Dormilich; Jul 22 '11, 05:09 AM. Reason: please use [CODE] [/CODE] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I don’t know which language that is, but it’s definitely not JavaScript (JS is a loosely typed, prototype based language).

    Comment

    Working...