Jump to content

[SOLVED] call function dynamically


DaveEverFade

Recommended Posts

It's a very long and complex code but essentially I would pass the function name through another function onclick so eg:

 

<img onclick="Test('Test2')">

 

function Test(params)

{

params()

}

 

function Test2()

{

do what I actually need to do..

}

The problem is that I need the function name in quotes because it wont always be a function name. It may be a somthing like 'id=2' at the moment I have a rather large switch on it but it's just getting too big. Can I turn it back into an object maybe?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.