Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14579

Function Objects

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.lang.javascript
Subject Function Objects
Date 2012-06-19 16:35 -0700
Organization A noiseless patient Spider
Message-ID <bm22u7l5dbs0rrdeloru3fd3sct7n8g201@4ax.com> (permalink)

Show all headers | View raw


Dear JavaScripters:

     In each case, the code is the in the head of the page.

     I can code

var Output;
Output=alert;
Output("This is the output.");

and see the expected alert box.

    I can code

var Output;
Output=document.write;
Output("This is the output.");

but I do not get the output.  I get an error of "Error: Invalid
calling object".

    I can code

var Output;
Output=document;
Output.write("This is the output.");

and see an output line in the body.

     Why is the second example above wrong?  I am using IE 9 on
Windows 7.

Sincerely,

Gene Wirchenko

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Function Objects Gene Wirchenko <genew@ocis.net> - 2012-06-19 16:35 -0700
  Re: Function Objects Stefan Weiss <krewecherl@gmail.com> - 2012-06-20 02:09 +0200
    Re: Function Objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-20 15:43 +0200
    Re: Function Objects Stefan Weiss <krewecherl@gmail.com> - 2012-06-20 17:29 +0200

csiph-web