Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Javascript: Changing css attributes

Namecheap AuctionsNamecheap Auctions
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
•••
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
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back