Sometimes you want to pass a function around from script to script as a string containing the function name (well maybe not, but I have some legacy code that does require this)

So if you have a function called doSomething() and you want to call it from another page, but you’ve passed it like so:

<script type="text/javascript">
function startSequence()
    var nextFunction = 'doSomething';
    return nextFunction;

So what I’m saying is the function will be placed into the Window object, so you can call it :


And it obviously extends to the window.opener object.

I’m sure there are better ways, but this is handy to know I think.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.