|
-
Using an array to reference an HTML element
Hi
I am trying to create an array in a javascript function which will hold some button elements in HTML, so that I can loop them in Javascript.
I can't get the below code to work:
function buttonclick() {
var array = ()
array[0]='button_background';
array[1]='button_menu';
array[2]='button_faq';
y = array[0]
y.style.backgroundColor="#cc00cc";
This obviously isn't the complete code...no loop etc. But I am just struggling to get the correct syntax for the above.
Any help would be really greatly appreciated.
Many Thanks
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks