[Resolved] Creating a Generic Mouseover Event

I want one Mouseover Event to be triggered when the labels are hovered

Page 1 of 1

2 Replies - 2504 Views - Last Post: 30 December 2008 - 10:44 AM Rate Topic: -----

#1 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

[Resolved] Creating a Generic Mouseover Event

Posted 30 December 2008 - 07:36 AM

I know the code is incorrect, but I can't remember how I originally had it. I've tried several different things and I'm just not sure where to go from here. This is actually a web user control I'm creating...

Here's the HTML of the page:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="wucMenu.ascx.vb" Inherits="wucMenu" %>
<style type="text/css">
@import "css/menu.css";
</style>
<ul id="mainMenu">
    <li><a id="homeLink" runat="server" href="index.aspx" onmouseover="Hover_Event()">Home</a></li>
    <li><a id="productLink" runat="server" href="products.aspx" onmouseover="Hover_Event()">Products</a></li>
    <li><a id="servicesLink" runat="server" href="services.aspx" onmouseover="Hover_Event()">Services</a></li>
    <li><a id="newsLink" runat="server" href="news.aspx" onmouseover="Hover_Event()">News & Events</a></li>
    <li><a id="feedbackLink" runat="server" href="feedback.aspx" onmouseover="Hover_Event()">Inquiry / Feedback</a></li>
    <li><a id="supportLink" runat="server" href="support.aspx" onmouseover="Hover_Event()">Technical Support</a></li>
    <li><a id="compInfoLink" runat="server" href="compInfo.aspx" onmouseover="Hover_Event()">Company Information</a></li>
    <li><a id="careersLink" runat="server" href="careers.aspx" onmouseover="Hover_Event()">Careers</a></li>
</ul>
<ul id="prodMenu" runat="server">
    <li>MICS</li>
    <li>Shift Manager</li>
    <li>NETS</li>
</ul>
<ul id="servMenu" runat="server">
    <li>Billing</li>
</ul>
<ul id="newsMenu" runat="server">
    <li>Press Release</li>
    <li>User Conferences & Forums</li>
    <li>Trade Shows</li>
</ul>
<ul id="suppMenu" runat="server">
    <li>Request Form</li>
    <li>Bomgar</li>
</ul>
<ul id="compInfoMenu" runat="server">
    <li>History</li>
    <li>Employees</li>
    <li>Testimonials</li>
    <li>Contact Us</li>
</ul>


Here's the ASP.NET Code behind:
Partial Class wucMenu
    Inherits System.Web.UI.UserControl
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        prodMenu.Visible = False
        servMenu.Visible = False
        newsMenu.Visible = False
        suppMenu.Visible = False
        compInfoMenu.Visible = False
    End Sub


    Protected Sub Hover_Event(ByVal sender As Object)
        sender.Attributes("background-image") = "../images/menuHover.gif"
        sender.Attributes("border-style") = "inset"
        sender.Attributes("background-repeat") = "repeat-x"
        sender.Attributes("overflow") = "hidden"
    End Sub
End Class



And last but not least is the CSS for the page.
#mainMenu
{
	margin-left: -2px;
	padding: 0;
	background-image:url(../images/menuBack.gif);
	list-style-type: none;
	background-repeat:repeat-x;
	overflow: hidden;
	width: 795px;
}

li
{
	float: left;
	padding: 0px 7.5px 0px 7.5px;
	border: outset 2px blue;
}

li a
{
	color: White;
	text-decoration: none;
}
/*
li a:hover
{
	background-image:url(../images/menuHover.gif);	
	background-repeat:repeat-x;
	overflow: hidden;
	border: outset 2px blue;
}
*/



Okay, I have the over commented out. I want the label attributes to be changed on mouseover, not the a attributes which is why it's commented out.

But I'm not sure what I need to do. I only need one event since each label is changed the same way. It needs to be generic to work for them all, but I'm at a loss.

Any help? Please??

This post has been edited by MacAnimeGirl: 30 December 2008 - 03:08 PM


Is This A Good Question/Topic? 0
  • +

Replies To: [Resolved] Creating a Generic Mouseover Event

#2 MacAnimeGirl  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 282
  • Joined: 30-September 08

Re: [Resolved] Creating a Generic Mouseover Event

Posted 30 December 2008 - 08:20 AM

Okay I feel stupid now... I just changed the li a:hover to li:hover and that fixed it...

How do I keep doing this to myself... I kept thinking, when the thought occurred to me, it couldn't be that easy... Low and behold changed it and it worked...

I feel like such an idiot...

Thanks to everyone who read my post... Sorry for the trouble...
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: [Resolved] Creating a Generic Mouseover Event

Posted 30 December 2008 - 10:44 AM

Glad you were able to solve the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1