Newbie Totally Confused

Discussion in 'Javascript' started by eBob.com, Feb 3, 2008.

  1. eBob.com

    eBob.com Guest

    I am getting into javascript because I want to extend the IE context menu.
    I've made the registery changes such that my context menu addition results
    in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
    contains

    <SCRIPT>
    alert(external.menuArguments.document.URL);
    </SCRIPT>

    I get the expected result.

    However, if the file contains

    <SCRIPT>
    document.write("I love JavaScript");
    </SCRIPT>

    nothing happens. No error message, nothing.

    However, if I enter the URL for the file above (the "I love JavaScript" one)
    in the IE address window, then, after OKing a few security questions, I do
    see the expected result.

    I sense that this is not strictly a javascript question but rather pertains
    to javascript when executed as the result of an IE context menu addition.
    If document.write just doesn't work when executed as the result of an IE
    context menu addtion then I wonder what else might not work and whether I
    need to find another way to achieve what I am trying to do.

    It's easy to find introductory javascript info on the web, and it's easy to
    find how to make additions to the IE context menu on the web. But, so far,
    I have not been able to find any introductory javascript material which is
    specific to IE context menu additions.

    I'll be grateful for any assistance anyone can provide.

    Thanks, Bob
     
    eBob.com, Feb 3, 2008
    #1
    1. Advertising

  2. eBob.com wrote:
    > I am getting into javascript because I want to extend the IE context menu.
    > I've made the registery changes such that my context menu addition results
    > in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
    > contains
    >
    > <SCRIPT>
    > alert(external.menuArguments.document.URL);
    > </SCRIPT>
    >
    > I get the expected result.
    >
    > However, if the file contains
    >
    > <SCRIPT>
    > document.write("I love JavaScript");
    > </SCRIPT>
    >
    > nothing happens. No error message, nothing.


    Well you need
    external.menuArguments.document.write("...")
    obviously, to write to the document in the window where the context menu
    has been used. That should work, however calling document.write on an
    already loaded document does an implicit document.open() meaning the
    document.write overwrites the existing document. Usually you don't want
    to do that from the context menu.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 3, 2008
    #2
    1. Advertising

  3. eBob.com

    VK Guest

    On Feb 3, 6:22 pm, "eBob.com" <> wrote:
    > I am getting into javascript because I want to extend the IE context menu.
    > I've made the registery changes such that my context menu addition results
    > in the execution of file:///C:\IEScriptGames\testscript.htm. If the file
    > contains
    >
    > <SCRIPT>
    > alert(external.menuArguments.document.URL);
    > </SCRIPT>
    >
    > I get the expected result.
    >
    > However, if the file contains
    >
    > <SCRIPT>
    > document.write("I love JavaScript");
    > </SCRIPT>
    >
    > nothing happens. No error message, nothing.
    >
    > However, if I enter the URL for the file above (the "I love JavaScript" one)
    > in the IE address window, then, after OKing a few security questions, I do
    > see the expected result.
    >
    > I sense that this is not strictly a javascript question but rather pertains
    > to javascript when executed as the result of an IE context menu addition.


    I would even say it is a question of specific Windows/IE extension.
    microsoft.public.windows.inetexplorer.ie6.browser would be a more
    appropriate place to ask (they discuss IE7 as well).
     
    VK, Feb 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peterson

    Totally NewBie Question

    Peterson, Aug 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    366
    tom pester
    Aug 20, 2005
  2. James Gregory

    Size of a struct - totally confused

    James Gregory, Jan 30, 2004, in forum: C++
    Replies:
    11
    Views:
    3,219
    EventHelix.com
    Jan 31, 2004
  3. stef mientki

    LEGB rule, totally confused ...

    stef mientki, Aug 14, 2007, in forum: Python
    Replies:
    6
    Views:
    679
    Diez B. Roggisch
    Aug 15, 2007
  4. Lloyd Sheen

    Totally confused

    Lloyd Sheen, Mar 6, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    358
    Lloyd Sheen
    Mar 28, 2008
  5. Giampaolo Rodola'
    Replies:
    17
    Views:
    1,078
    John Machin
    Jan 18, 2009
Loading...

Share This Page