Script

出自OpenFace

跳转到: 导航, 搜索

<script>

A block of JavaScript.

The script element contains JavaScript code that is executed when the application is loaded. This element must be at the canvas level; that is, it cannot be contained within any subordinate tag. If the src attribute is present, it names a JavaScript file whose contents are compiled into the application.

<canvas height="200" width="400" efcdebug="true">
  <script><![CDATA[
     function find(what){
         Debug.write("@@type of what:"+typeof(what));
     }
     sneaky = {example: 'sneaky'};
     find(42);
     find(false);
     find("bar");
     find(sneaky);
 ]]></script>
</canvas>

Attributes

Name    Usage    Type (Tag)     Type (JS)    Default    Category

src    Tag only     URL                final

       The pathname of a JavaScript file. This pathname is resolved relative to the file that contains the <script> element.