Dynadot — .com Transfer

Javascript: Changing css attributes

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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back