can you call a java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Laura

    #1

    can you call a java

    Hello,

    I'm having a problem using Javascript. This may not even be possible,
    but maybe there is another way of going about it.

    I have a bunch of .js files that I insert into my my html file using
    the <script> tag, and this works just fine. The .js files contain
    info about the menu, table set up, etc. and take care of the page
    format.

    But now, I have a tidbit of Javascript in an htm file, and this tidbit
    opens up a new window with some information on it. I want to insert
    all of the menu and format javascript files on this new window that it
    opens.

    so, my question is: how would I do this: (since this doesn't work!)

    output.document .write('<SCRIPT language=JavaSc ript
    src="/scripts/menu_array.js" type=text/javascript></SCRIPT>');

    ???

    Any help is very much appreciated!!

    Laura
  • Andrew Thompson

    #2
    Re: can you call a java

    On 14 Jul 2004 08:59:17 -0700, Laura wrote:
    [color=blue]
    > Hello,[/color]

    Sub: can you call a java

    Hi Laura!

    Unfortunately I cannot answer your Javascript question,
    as I am just here to learn as well, but I *can*
    reliably inform you that 'Java' is a completely
    separate and different language from 'Javascript'.

    It is important not to mix up the terms,
    especially when you are posting to the
    technical groups for these languages,
    because it can confuse those who are 'skimming'
    looking for posts that can be answered quickly.

    This one, for example, might prompt something like..

    Java != JS
    <http://www.physci.org/codes/javafaq.jsp#js>

    ;-)

    I'll bow out now, and hopefully one who
    is conversant with Javascript will happen
    by in a moment..

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology

    Comment

    • kaeli

      #3
      Re: can you call a java

      In article <3b666b7a.04071 40759.3f8cc6a3@ posting.google. com>,
      salamahl@aecl.c a enlightened us with...[color=blue]
      >
      > But now, I have a tidbit of Javascript in an htm file, and this tidbit
      > opens up a new window with some information on it. I want to insert
      > all of the menu and format javascript files on this new window that it
      > opens.
      >
      > so, my question is: how would I do this: (since this doesn't work!)[/color]

      Depends on how you opened it and where it got its content from.
      [color=blue]
      >
      > output.document .write('<SCRIPT language=JavaSc ript
      > src="/scripts/menu_array.js" type=text/javascript></SCRIPT>');
      >[/color]

      That would work fine IF you opened and wrote all the rest of the content
      dynamically as well. It sounds like you are opening an already existing
      document, though, so it won't work.

      You could hack a script that targeted the new window with the javascript
      protocol and appended a script element to the page IF the content of the
      page is from the same domain. Is it? Sounds like it is.

      Such a script would only work in DOM browsers, such as IE6+/NN7+. Is
      that acceptable?

      --
      --
      ~kaeli~
      User: The word computer professionals use when they mean
      'idiot'.



      Comment

      • Dr John Stockton

        #4
        Re: can you call a java

        JRS: In article <3b666b7a.04071 40759.3f8cc6a3@ posting.google. com>, seen
        in news:comp.lang. javascript, Laura <salamahl@aecl. ca> posted at Wed, 14
        Jul 2004 08:59:17 :[color=blue]
        >
        >But now, I have a tidbit of Javascript in an htm file, and this tidbit
        >opens up a new window with some information on it. I want to insert
        >all of the menu and format javascript files on this new window that it
        >opens.[/color]

        I have code which will display named functions in a new window, and at
        least most code can be put into a function.

        See <URL:http://www.merlyn.demo n.co.uk/js-index.htm#CD> and press the
        button.

        That may help with what you want.

        --
        © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
        <URL:http://jibbering.com/faq/> JL / RC : FAQ for news:comp.lang. javascript
        <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

        Comment

        • Laura Salamah

          #5
          Re: can you call a java

          Hi Andrew (and all),

          I'm sorry about the subject of this posting. In my absentmindednes s,
          while I was thinking of an effective title, I didn't complete it.

          I apologise for the the confusion!

          Laura

          *** Sent via Developersdex http://www.developersdex.com ***
          Don't just participate in USENET...get rewarded for it!

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: can you call a java

            Laura wrote:[color=blue]
            > But now, I have a tidbit of Javascript in an htm file, and this tidbit
            > opens up a new window with some information on it. I want to insert
            > all of the menu and format javascript files on this new window that it
            > opens.
            >
            > so, my question is: how would I do this: (since this doesn't work!)[/color]

            "Does not work" is a useless error description. [psf 4.11]

            <http://jibbering.com/faq/#FAQ4_43>
            [color=blue]
            > output.document .write('<SCRIPT language=JavaSc ript
            > src="/scripts/menu_array.js" type=text/javascript></SCRIPT>');[/color]

            I suggest that one of the previous lines matched at least partly

            var output = window.open(... );

            If so, and if this script is included in a HTML document, it is
            important that you escape End Tag Open (ETAGO) delimiters within
            the script. The markup parser will probably consider either the
            `</script>' or any ETAGO delimiter (`</') the end of the script
            that *creates* the popup's document which would in turn result
            in erroneous, because incomplete, script code.

            Furthermore, you need to check if `output' is a useful Window
            object reference before you access it, then open the stream
            before you can reliably write to it, and close it when you are
            finished:

            if (output && !output.closed)
            {
            var d;
            if ((d = output.document ) && d.open && d.write && d.close)
            {
            d.open();
            d.write(
            '<!-- additional code to make this Valid (X)HTML -->'
            + '<script src="/scripts/menu_array.js"'
            + ' type="text/javascript"><\/script>'
            + '<!-- additional code to make this Valid (X)HTML -->');
            d.close();
            }
            }
            [color=blue]
            > ???[/color]

            Your Question Mark key is borken. [psf 2.3]


            PointedEars

            Comment

            Working...