Making a function with a random name and calling it later

So I'm trying to make a function that will have a random name generated on page load, but I'm having problems calling the method later. This is what I got so far:

 var methodName = Math.floor(Math.random()*1000001);   
 window[methodName] = function(){
     alert("It works!");
 window.onload = function start() {

But I'm having problems calling it, since methodName(); would actually be a random number. So how could I call the methodName() function?


You can reference the property the same way that you set it:


Need Your Help

Android - Custom Button gets stuck “Pressed”

android button

I've created a custom button in my Android app that has basically two different views. There is an image for when the button isn't being pressed and another image for use while it is being pressed.

Firefox toolbarbutton context ( right click menu on toolbar )

firefox firefox-addon xul

In Chrome, its possible to make context menu items for extension icons, like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.