Login  Register

Re: Learning JavaScript [OT]

Posted by Robert Baer on Aug 10, 2010; 7:21pm
URL: http://imagej.273.s1.nabble.com/Learning-JavaScript-tp3687295p3687297.html

First, this would not seem to be a proper ImageJ post since it does mpt
specifically apply to using ImageJ.

That said, my guess is that you do not understand that JavaScript and Java
are two entirely different languages, albeit with similar syntax.  java.awt
is a collection of Java 2.0 user interface classes and has little to do with
the JavaScript engine built into Firefox.

HTH,

Rob

>I have been trying to teach myself JavaScript by writing code embedded in
> html and then loading that in Moszilla Firefox 3.6.8. But, I can't get it
> to
> understand importPackage(java.awt). I just get an error message that says
> "Error: importPackage is not defined". Does anyone know what the problem
> coud be? The html is included below.
>
> David Webster
>
> <html>
> <head>
>  <title>Run JavaScript File</title>
> </head>
> <body>
>  <h1>Javascript File Test Begin</h1>
>  <script language="JavaScript" type="text/JavaScript">
>   importPackage(java.awt);
>  </script>
>  <h2>Javascript File Test End</h2>
> </body>
> </html>
>