Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1296 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

onMouse over / out shange div id?

Thread title: onMouse over / out shange div id?
Closed Thread    
    Thread tools Search this thread Display Modes  
08-19-2006, 08:02 PM
#1
VividWire is offline VividWire
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 262
iTrader: 0 / 0%
 

VividWire is on a distinguished road

  Old  onMouse over / out shange div id?

Is it possible to create some javascript which changes the Div Id on rollover? I am re-coding my site witt tableless CSS and at the moment I am using the following code:


<td class="cont-subbutton" onMouseOut="this.div id='cont-subbutton';" onMouseOver="this.className='cont-subbuttonhover'"><a href="/index.php?content=network">The Network </a></td>
Is it possible to change this so that rather than chaning the class it changes the div id?

08-20-2006, 03:22 AM
#2
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

You need to use a class anyway. You shouldn't use an identifier for an element that will appear more than once in a page, because it needs to identify an exclusive element.

However, instead of using that JavaScript, if you want to utilise CSS properly, you should use a pseudo class for the anchor. So for that code you should have:
Code:
<a title="The Network" href="/index.php?content=network" class="cont-subbutton">The Network</a>
And then for your CSS:
Code:
a.cont-subbutton {
	[css rules here]
}

a.cont-subbutton:hover {
	[css rules for when the link is hovered on here]
}
Hope that helps.

P.S. More about CSS selectors.

P.P.S. Someone fix this goddam overflow on the code boxes! It annoys the hell out of me.

08-20-2006, 07:10 PM
#3
VividWire is offline VividWire
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 262
iTrader: 0 / 0%
 

VividWire is on a distinguished road

  Old

Thanks for the reply, the thing is I am trying to change the bckground style on the hover-over. So if I set the a:hover setting then the background style only shows behind the text and not the 150px width and 20px height that I want it to.

08-20-2006, 07:18 PM
#4
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

Then you can add a height and width onto the anchor using the CSS if you don't mind the whole area being clickable.

08-20-2006, 07:28 PM
#5
VividWire is offline VividWire
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 262
iTrader: 0 / 0%
 

VividWire is on a distinguished road

  Old

This is the current CSS for it, it doesnt seem to set the height or width though:

a.cont-subbutton {
height: 16px;
color: #999999;
font-size: 10px;
background-repeat: repeat-y;
background-position: right;
vertical-align: middle;
padding-right: 7px;
padding-top: 4px;
}


a.cont-subbutton:hover{
height: 20px;
color: #999999;
font-size: 10px;
background-position: right;
vertical-align: middle;
padding-right: 7px;
padding-top: 4px;
background-image: url(images/main/cont-navactive.jpg);
width: 150px;
}

08-20-2006, 08:47 PM
#6
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

I don't know exactly what you want your menu to look like, but check out http://css.maxdesign.com.au/listamatic/. They have lots of examples of menus and the code for them. I'm sure you'll be able to find some code that you can alter there.

08-20-2006, 09:35 PM
#7
VividWire is offline VividWire
Status: Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 262
iTrader: 0 / 0%
 

VividWire is on a distinguished road

  Old

That helped alot, got the sub-navigation working now.

Thanks for your help.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed