Search code examples
prototypejs

Call function from external .js file



I have a draw.js file with me which has a function as

var drawArrow=function(x1,y1,x2,y2)
{ 
// some code 
}

In my html page in head I wrote

<script type="text/javascript" src="draw.js"></script>
<script type="text/javascript">
  function callme() {
  // insert code here
  }
</script>

Please tell me waht code do I need to write in callme() to call drawArrow function of draw.js.


Solution

  • Nothing is external when you call js file all methods are easily accessible as it is create on same page now simply do this

    <script type="text/javascript">
      function callme() {
    drawArrow=function(x1,y1,x2,y2);
      // insert code here
      }
    </script>