[Jslib] example code that doesn't work for me...

stknight at ultralifebatteries.com stknight at ultralifebatteries.com
Mon Sep 8 18:03:35 EDT 2003


Greetings,

I've just installed jslib today and have almost immediately run into
problems.

specifically, the example code below generates a "File is not defined" (line
18) in the Javascript console.  The window appears, the buttons attempt to
work but that error definitely puts a crimp in what I want to do.

The splash screen (chrome://jslib/content/) from either the command line
(Cygwin) or in Mozilla's locator, no problem.

Windows 2000
Mozilla 1.4

I've seen similar errors reported in either your archives or via Google, but
nobody seems to have ever posted the fix.

Any suggestions?

Example code:
<?xml version="1.0"?>
<!DOCTYPE window>
<window id="jslib-file-test"
    style="background-color: #cccccc; width: 100px; height: 100px;"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>


    <script type="application/x-javascript"
        src="chrome://jslib/content/jslib.js"
    />

    <script type="application/x-javascript">
        include( jslib_io );
        // a local file path
        var localFile = "/tmp/fubar.dat";
        var f = new File(localFile);
    </script>
    <vbox flex="1" pack="center">
        <spacer flex="1" />
        <button label="Function List" oncommand="alert(f.help);" />
        <button label="exists" oncommand="alert(f.exists());" />
        <button label="create file" oncommand="if (!f.exists()) f.create();"
/>
        <spacer flex="1" />
    </vbox>
</window>


------
Stephen Knight
Ultralife Batteries, Inc.
315-332-7100 x628




This message was scanned for viruses before being allowed to leave Ultralife Batteries mail servers.




More information about the Jslib mailing list