Geek Valley
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Go Back   Geek Valley > Web Development Geeks > Client Side Coding Help and Discussion
User Name
Password

Google Ad

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 09-12-2007, 09:03 AM   #1
flann
Registered User
 
Join Date: Jul 2005
Posts: 33 flann is on a distinguished road
calling javascript function using array values

What i'm trying to do is use an array or variable to call a particular function. I know that I could use a switch statement to do this, however I would like to find out if it is also possible this way.

PHP Code:
 <script>
function 
test1() {
    
alert('test1');
}

function 
test2() {
    
alert('test2');
}

myArray = new Array();
myArray[0] = "test1";
myArray[1] = "test2";

// I really thought this would work, but it didn't
myArray[0]();
</script> 
__________________
Flann
Mortgage Calculator | golBi | Interest Only Mortgage
flann is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
15 USD for sell:6300 6310 6315 6340 6356 Thumb Keyboard rainwong Client Side Coding Help and Discussion 0 05-17-2007 11:13 AM
15 USD for sell:HP IPAQ Thumb Keyboard HSTNH-D01K rainwong Client Side Coding Help and Discussion 0 05-17-2007 11:11 AM
All Javascript code placed in an external JS file as well? razsports Client Side Coding Help and Discussion 4 01-27-2005 03:13 PM



All times are GMT -6. The time now is 04:26 PM.

Primary Sponsor: eMotion Picture Studios, Toronto

Interior Designer Oakville


Powered by: vBulletin Version 3.0.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
forum style designed by eMotion Digital Marketing, Toronto