SunQuest
           CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 2nd, 2003, 07:01 AM
TimvanSas TimvanSas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Netherlands
Posts: 43 TimvanSas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 43 sec
Reputation Power: 5
Question about css navigation

Hello,

I have a question about how to build a navigation is css.
The navigation i have so far does a swap class on a mouseover and on the mouseouts the class swaps back to the class he began with.

Code:
<tr>
		<td width=173 height=21 class="naviglinksBT" style="cursor: hand;" onclick="parent.frames.contentHR.document.location.href='content_main.htm';" onmouseover="this.className='naviglinksBTOver';window.status='Home';return true" onmouseout="this.className='naviglinksBT';window.status='';return true">Home</td>
		<td rowspan=4><img src="images/cirkelsnaastKnoppen.gif" width=17 height=85></td>
	</tr>
	<tr>
		<td height=21 class="naviglinksBT" style="cursor: hand;" onclick="parent.frames.contentHR.document.location.href='content_nieuws.asp';" onmouseover="this.className='naviglinksBTOver';window.status='Nieuws';return true" onmouseout="this.className='naviglinksBT';window.status='';return true">Nieuws</td>
	</tr>
	<tr>
		<td height=21 class="naviglinksBT" style="cursor: hand;" onclick="parent.frames.contentHR.document.location.href='content_vacatures.asp';" onmouseover="this.className='naviglinksBTOver';window.status='Vacatures';return true" onmouseout="this.className='naviglinksBT';window.status='';return true">Vacatures</td>
	</tr>
	<tr>
		<td height=22 class="naviglinksBT2" style="cursor: hand;" onclick="parent.frames.contentHR.document.location.href='content_contactform.htm';" onmouseover="this.className='naviglinksBTOver';window.status='Contactformulier';return true" onmouseout="this.className='naviglinksBT2';window.status='';return true">Contactformulier</td>
	</tr>


This works all fine, but now i comes the difficult part (for me that is). Now i want the navigation to be 'on' after a onClick, but it must be set to true when i click a other link (in that navigation).

So when you go over the <td> it swaps a class, when you click it it takes that class and when you click on another link it must be set to the default again.

Hope somebody can help me
Thanks in advance.

Tim

Reply With Quote
  #2  
Old November 2nd, 2003, 01:23 PM
rvh rvh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 rvh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i had that problem too, i solved it like this
onmouseover color: #0000ff
onclick color: #0000fe
onmouseout color: #000000

if you want a working example of it go to http://www.primusnet.nl/top.asp

and don't look at the crappy coding, i only wrote the script

Reply With Quote
  #3  
Old November 2nd, 2003, 01:31 PM
TimvanSas TimvanSas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Netherlands
Posts: 43 TimvanSas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 43 sec
Reputation Power: 5
Thanks for the reply, i will get into right away.
I really need a solution for this problem, i've played today abit and i now got that the it goes good when you only apply a onClick.

But i want it to change class on a mouseover, return to true on mouseout and stays on with the onClick.

I will take a look @ primus Thanks in advance.



Tim

Edit: The primus site didn't gave me the answer i needed .
I want the whole cell to do his thing. The problem is my onMouseOut. Help meeeeeeeee!

Last edited by TimvanSas : November 2nd, 2003 at 02:28 PM.

Reply With Quote
  #4  
Old November 2nd, 2003, 06:56 PM
rvh rvh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 rvh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ok here goes
Code:
<script type="text/javascript">
MouseOverOff = '#cc0000'
MouseOverOn = '#cc0001'
Off = '#06478e'
var clicked
function clicked(button){
Parent = button.parentElement;
for (
	the_buttons = 0;
	the_buttons < Parent.children.length;
	the_buttons ++
	)
Parent.children[the_buttons].style.color=Off,
button.style.color=MouseOverOff;
}
function out(button){
	if (button.style.color == MouseOverOff) button.style.color=MouseOverOff; else button.style.color=Off;
}
function over(button){
	if (button.style.color == MouseOverOff) button.style.color=MouseOverOff; else button.style.color=MouseOverOn;
}
</script>

<table>
	<tr> 
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	  <td onClick="clicked(this)" onMouseOver="over(this)" onMouseOut="out(this)">Button</td>
	</tr>
</table>


That should work, but this one only works like this, you will have to change the code a bit to get it working with anything else (like images or divs)

ofcourse you can change the stylesheet too i think that should with button.class but i'm not sure

Last edited by rvh : November 2nd, 2003 at 07:02 PM.

Reply With Quote
  #5  
Old November 3rd, 2003, 01:52 AM
TimvanSas TimvanSas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Netherlands
Posts: 43 TimvanSas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 43 sec
Reputation Power: 5
Thanks again rvh.
But this i have tried/done allready, it's easy and works nice. But this only change the link and i want the whole cell to change.

Maybe it's very simple and am i seeing something over the head but i can't figure it out.


Tim

Reply With Quote
  #6  
Old November 3rd, 2003, 04:44 AM
rvh rvh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 rvh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
just replace "button.style.color" with "button.className" and the settings (MouseOverOff = '#cc0000') with MouseOverOff = 'classname' ok?
i believe that should work

Reply With Quote
  #7  
Old November 3rd, 2003, 04:59 AM
TimvanSas TimvanSas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Netherlands
Posts: 43 TimvanSas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 43 sec
Reputation Power: 5
I've got it working.
Me and my co-worker wrote something wich is working nice. For those who are interested, here is the code we wrote:

Code:
<script language="JavaScript">
var menunr = -1
function wisseluit(n) {
	var strEval;
	if (menunr != n) {
		strEval = "document.pijl" + n + ".src = 'images/bullet-off.gif';"
		eval(strEval);
 		strEval = "knop" + n + ".className='navknoppen';"
		eval(strEval);
	}	
	window.status='';
	return true;
}	
function wisselaan(s, n) {
	var strEval = "document.pijl" + n + ".src = 'images/bullet-on.gif';"
	eval(strEval);
	var strEval = "knop" + n + ".className='navknoppenover';"
	eval(strEval);
	window.status= s;
	return true;
}	

function zetaan(n) {
	if (menunr > -1) {
		var	strEval = "document.pijl" + menunr + ".src = 'images/bullet-off.gif';"
		eval(strEval);
	 	strEval = "knop" + menunr + ".className='navknoppen';"
		eval(strEval);
	}	
	menunr = n;	
}

</script>

<br>
Code:
	<tr>
		<td id='knop1' colspan=3 class="navknoppen" onclick="zetaan(1);" onmouseover="wisselaan('Contact', 1);" onmouseout="wisseluit(1)"><img src="images/bullet-off.gif" name="pijl1" width="4" height="7"> &nbsp;Contactformulier</td>
	</tr>
	<tr>
		<td id='knop2' colspan=3 class="navknoppen" onclick="zetaan(2);" onmouseover="wisselaan('Downloads', 2);" onmouseout="wisseluit(2)"><img src="images/bullet-off.gif" name="pijl2" width="4" height="7"> &nbsp;Downloads</td>
	</tr>
	<tr>
		<td id='knop3' colspan=3 class="navknoppen" onclick="zetaan(3);" onmouseover="wisselaan('Links', 3);" onmouseout="wisseluit(3)"><img src="images/bullet-off.gif" name="pijl3" width="4" height="7"> &nbsp;Links</td>
	</tr>
	<tr>
		<td id='knop4' colspan=3 class="navknoppen" onclick="zetaan(4);" onmouseover="wisselaan('Bedrijfsinformatie', 4);" onmouseout="wisseluit(4)"><img src="images/bullet-off.gif" name="pijl4" width="4" height="7"> &nbsp;Bedrijfsinformatie</td>
	</tr>
		<tr>
		<td id='knop5' colspan=3 class="navknoppen" onclick="zetaan(5);" onmouseover="wisselaan('test', 5);" onmouseout="wisseluit(5)"><img src="images/bullet-off.gif" name="pijl5" width="4" height="7"> &nbsp;test</td>
	</tr>


Thanks for your time and advice rvh!


Tim

Last edited by TimvanSas : November 3rd, 2003 at 06:25 AM.

Reply With Quote
  #8  
Old November 3rd, 2003, 07:06 PM
rvh rvh is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 rvh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I would replace onclick="zetaan(1);" with onclick="zetaan(this);"

then you will not have to put the numbers in it anymore, just a bit easyer

nice script though

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Question about css navigation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway