/    Sign up×
Community /Pin to ProfileBookmark

onmouseclick in an array

Hi all,

I have searched for onmouseclick posts and have not found what I am looking for.

I have a buttons which has tab menus with links when you go over the button (code is [URL]http://www.dynamicdrive.com/dynamicindex1/tabmouseover.htm[/URL])

The button has a colour change. I want to be able to change the colour of the button when one of the links in the tab menu is clicked.

The links are in an array:

submenu[1]='<font size=”2″ face=”Verdana”><b><a href=”product_information.html” onmouseclick=”alert(“yeh”);”>AppleTS</a>

I have inserted the onmouselick as above to action the changeing of the button colour. (at present i have simple alert box to see if the code works which it does not work). Does anyone know how i can do this by still keeping my array?

Thanks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@NaldzNov 19.2006 — First of all all, it should not be onmouseclick but onclick. On the onclick event, assign a function that would change the color of your button.
[CODE]
submenu[1]='<font size="2" face="Verdana"><b><a href="product_information.html" onclick="changeColor('myButton');">AppleTS</a>

//assuming that the id of your button is 'myButton'

function changeColor(buttonID){
document.getElementById(buttonID).style.backgroundColor = 'red';
}
[/CODE]
×

Success!

Help @hanga17 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...