Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Javascript: Changing css attributes

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

VaporAction

Established Member
Impact
0
'm new to javascript so my code is probably all messed up...anyway, here goes...
I'm trying to make a drop down menu composed of images using javascript...
I tried making function that would be triggered by onMouseOver and onMouseOut events...
I know how to make it happen if I use a different function for each menu item...but for efficiency I tried writing the function so that it would know which menu item had called it and display the appropriate image...just for testing purposes, I'm only using 2 menu items right now...they're images with the id "topChem" and "topMin"

"topChem" when moused over should display "botChem"

"topMin" when moused over should display "botMin"

here's the code that hasn't been working...

Code:
function menuOver() {
	var source = window.event.srcElement.id;
	if (source==document.getElementById("topChem")) {
		document.getElementById("botChem").style.visibility = "visible";
	}
	else if (source==document.getElementById("topMin")) {
		document.getElementById("botMin").style.visibility = "visible";
	}
}
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Member card: see how many threads a member started
The member card now shows a Threads number, right after Posts. The member card is the box that opens when you point at a name. Profile...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back