473,471 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Easy JavaScript Problem (i hope)

I have got a small problem getting my dropdown menu to work. I want to
change the style with javascript.

Here is the code in my HTML:

<div id="navigation">

<ul>
<li id="lnot"><a href="index.html">Home</a></li>
<li id="lnot"><a href="graphics.html">Graphics</a></li>
<li id="lnot"><a href="templates.html">Templates</a></li>
<li id="lselected"><a href="software.html"
onMouseover="dropdownmenu(this, event, menu1, '150px')"
onMouseout="delayhidemenu()">Software</a></li>
<li id="lnot"><a href="services.html">Services</a></li>
<li id="lnot"><a href="contact.html" onmouseover="dropdownmenu(this,
event, menu2, '150px')" onMouseout="delayhidemenu()">Contact</a></li>

</ul>

</div>

Here is the code in my javascipt file:
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

How do I apply the style (this is in my style sheet):
#navigation a:active
{
color: #ffffff;
background-color: #485573;
}

On the javascipt function delayhidemenu so my background will change
when the menu dissappears?

Mar 17 '07 #1
9 2456
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
I have got a small problem getting my dropdown menu to work. I want to
change the style with javascript.

Here is the code in my HTML:

<div id="navigation">

<ul>
<li id="lnot"><a href="index.html">Home</a></li>
<li id="lnot"><a href="graphics.html">Graphics</a></li>
<li id="lnot"><a href="templates.html">Templates</a></li>
<li id="lselected"><a href="software.html"
onMouseover="dropdownmenu(this, event, menu1, '150px')"
onMouseout="delayhidemenu()">Software</a></li>
<li id="lnot"><a href="services.html">Services</a></li>
<li id="lnot"><a href="contact.html"
onmouseover="dropdownmenu(this,
event, menu2, '150px')" onMouseout="delayhidemenu()">Contact</a></li>

</ul>

</div>

Here is the code in my javascipt file:
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

How do I apply the style (this is in my style sheet):
#navigation a:active
{
color: #ffffff;
background-color: #485573;
}

On the javascipt function delayhidemenu so my background will change
when the menu dissappears?
Use different classes:

..firstClass a:active {color: #f00;background-color: #123456;}
..secondClass a:active {color: #fff;background-color: #485573;}
...............

<div id="navigation" class='firstClass'>
......

document.getElementById('navigation').className = 'secondClass';

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 17 '07 #2
On Mar 17, 12:33 pm, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
I have got a small problem getting my dropdown menu to work. I want to
change the style with javascript.
Here is the code in my HTML:
<div id="navigation">
<ul>
<li id="lnot"><a href="index.html">Home</a></li>
<li id="lnot"><a href="graphics.html">Graphics</a></li>
<li id="lnot"><a href="templates.html">Templates</a></li>
<li id="lselected"><a href="software.html"
onMouseover="dropdownmenu(this, event, menu1, '150px')"
onMouseout="delayhidemenu()">Software</a></li>
<li id="lnot"><a href="services.html">Services</a></li>
<li id="lnot"><a href="contact.html"
onmouseover="dropdownmenu(this,
event, menu2, '150px')" onMouseout="delayhidemenu()">Contact</a></li>
</ul>
</div>
Here is the code in my javascipt file:
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}
How do I apply the style (this is in my style sheet):
#navigation a:active
{
color: #ffffff;
background-color: #485573;
}
On the javascipt function delayhidemenu so my background will change
when the menu dissappears?

Use different classes:

.firstClass a:active {color: #f00;background-color: #123456;}
.secondClass a:active {color: #fff;background-color: #485573;}
..............

<div id="navigation" class='firstClass'>
.....

document.getElementById('navigation').className = 'secondClass';

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Can you give me more detail?(where to put the data) I tried to get it
to work but no luck. Like I said, I have a css file, a javascript
file, and the HTML file.

Mar 17 '07 #3
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
>Use different classes:

.firstClass a:active {color: #f00;background-color: #123456;}
.secondClass a:active {color: #fff;background-color: #485573;}
..............

<div id="navigation" class='firstClass'>
.....

document.getElementById('navigation').className = 'secondClass';

Can you give me more detail?(where to put the data) I tried to get it
to work but no luck. Like I said, I have a css file, a javascript
file, and the HTML file.
That is the wrong approach, meseems, test these things ou in a single
html file, and if all goes well, you van make seperate files.

Try this [I changed active to hover, easier to test]:

=========== test.html ==================================
<style type='text/css'>
.firstClass a:hover {color: #f00;background-color: #123456;}
.secondClass a:hover {color: #fff;background-color: #485573;}
</style>

<script type='text/javascript'>
function doit(){
document.getElementById('navigation').className = 'secondClass';
}
</script>
</head>

<body>
<div id="navigation" class='firstClass'>
<a href=''>========= hover test ===========</a>
</div>

<button onclick='doit()'>click me</button>
================================================== ========
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 17 '07 #4
On Mar 17, 2:23 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
Use different classes:
.firstClass a:active {color: #f00;background-color: #123456;}
.secondClass a:active {color: #fff;background-color: #485573;}
..............
<div id="navigation" class='firstClass'>
.....
document.getElementById('navigation').className = 'secondClass';
Can you give me more detail?(where to put the data) I tried to get it
to work but no luck. Like I said, I have a css file, a javascript
file, and the HTML file.

That is the wrong approach, meseems, test these things ou in a single
html file, and if all goes well, you van make seperate files.

Try this [I changed active to hover, easier to test]:

=========== test.html ==================================
<style type='text/css'>
.firstClass a:hover {color: #f00;background-color: #123456;}
.secondClass a:hover {color: #fff;background-color: #485573;}
</style>

<script type='text/javascript'>
function doit(){
document.getElementById('navigation').className = 'secondClass';}

</script>
</head>

<body>
<div id="navigation" class='firstClass'>
<a href=''>========= hover test ===========</a>
</div>

<button onclick='doit()'>click me</button>
================================================== ========

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Take a look at:
http://thetechturf.com/software2.html
I want the hover to still work when I drop down the menu.
I am still trying to get this to work.

Mar 17 '07 #5
On Mar 17, 2:28 pm, "thetechturf.com" <BryanLBurkhol...@gmail.com>
wrote:
On Mar 17, 2:23 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
>Use different classes:
>.firstClass a:active {color: #f00;background-color: #123456;}
>.secondClass a:active {color: #fff;background-color: #485573;}
>..............
><div id="navigation" class='firstClass'>
>.....
>document.getElementById('navigation').className = 'secondClass';
Can you give me more detail?(where to put the data) I tried to get it
to work but no luck. Like I said, I have a css file, a javascript
file, and the HTML file.
That is the wrong approach, meseems, test these things ou in a single
html file, and if all goes well, you van make seperate files.
Try this [I changed active to hover, easier to test]:
=========== test.html ==================================
<style type='text/css'>
.firstClass a:hover {color: #f00;background-color: #123456;}
.secondClass a:hover {color: #fff;background-color: #485573;}
</style>
<script type='text/javascript'>
function doit(){
document.getElementById('navigation').className = 'secondClass';}
</script>
</head>
<body>
<div id="navigation" class='firstClass'>
<a href=''>========= hover test ===========</a>
</div>
<button onclick='doit()'>click me</button>
================================================== ========
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Take a look at:http://thetechturf.com/software2.html
I want the hover to still work when I drop down the menu.
I am still trying to get this to work.
Some clarification on that last post, If you look, when you drop down
the menu on "Contact", "Contact" will not retain the hover color. I do
not want the hover color do disappear until I am off of the dropdown
menu, OR click something on the menu.

Mar 17 '07 #6
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
>=========== test.html ==================================
<style type='text/css'>
.firstClass a:hover {color: #f00;background-color: #123456;}
.secondClass a:hover {color: #fff;background-color: #485573;}
</style>

<script type='text/javascript'>
function doit(){
document.getElementById('navigation').className = 'secondClass';}

</script>
</head>

<body>
<div id="navigation" class='firstClass'>
<a href=''>========= hover test ===========</a>
</div>

<button onclick='doit()'>click me</button>
================================================= =========

Take a look at:
http://thetechturf.com/software2.html
I want the hover to still work when I drop down the menu.
I am still trying to get this to work.
No, I am not going to do your work.
The above should set you to workt yourself.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 17 '07 #7
On Mar 17, 2:54 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
=========== test.html ==================================
<style type='text/css'>
.firstClass a:hover {color: #f00;background-color: #123456;}
.secondClass a:hover {color: #fff;background-color: #485573;}
</style>
<script type='text/javascript'>
function doit(){
document.getElementById('navigation').className = 'secondClass';}
</script>
</head>
<body>
<div id="navigation" class='firstClass'>
<a href=''>========= hover test ===========</a>
</div>
<button onclick='doit()'>click me</button>
================================================== ========
Take a look at:
http://thetechturf.com/software2.html
I want the hover to still work when I drop down the menu.
I am still trying to get this to work.

No, I am not going to do your work.
The above should set you to workt yourself.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
I appreciate the help, but you musta told me something wrong, because
its not working. I can get the test file to work, but as soon as I try
to implement it, it doesn't do anything. I'm just gonna forget it and
go with it.

Mar 17 '07 #8
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
>No, I am not going to do your work.
The above should set you to workt yourself.

I appreciate the help, but you musta told me something wrong, because
its not working. I can get the test file to work, but as soon as I try
to implement it, it doesn't do anything. I'm just gonna forget it and
go with it.
If the testfile works, jour jump to youe application is to large.

Try to expand the idea in small debuggable tests, and you wil not only get
to it working, but also learn.

btw, why did you mention is was an easy problem?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 17 '07 #9
I will plug away at it in my spare time. I blew most of today trying
to get it to work. The reason I thought it was going to be easy is
because I thought there was an easier way to do it. It seemed like a
simple problem, therefore I thought a simple solution. GUESS NOT! Well
anyway, thanks for you help.

Bryan Burkholder
www.thetechturf.com

Evertjan. wrote:
thetechturf.com wrote on 17 mrt 2007 in comp.lang.javascript:
No, I am not going to do your work.
The above should set you to workt yourself.
I appreciate the help, but you musta told me something wrong, because
its not working. I can get the test file to work, but as soon as I try
to implement it, it doesn't do anything. I'm just gonna forget it and
go with it.

If the testfile works, jour jump to youe application is to large.

Try to expand the idea in small debuggable tests, and you wil not only get
to it working, but also learn.

btw, why did you mention is was an easy problem?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 17 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joanne | last post by:
I wish to know more about javascript. Hope that have somebody can help me solve this problem. Just tell me which types of javescript is easy to learn and easy to use. Thank.
5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
2
by: Jim Heavey | last post by:
Hello, I created a simple javascipt routine to do some validation. I attached that script to my ASP Button with the following code... cmdAddTask.Attributes = "javascript:return...
2
by: VMI | last post by:
In the Page_Load() of my webForm, I have the following code, and on my HTML button, the onclick button calls writeVal() (the javascript function). When I click on the button, I see the messagebox...
3
by: jesper_lofgren | last post by:
Hello, I have a problem, i have a event in asp.net codebehind file that updating a datasource. If that update went well i want to refresh my treeview thats on another page. The script works...
8
by: printline | last post by:
Hello I'm a bit new to javascript. Hope somebody can help me I have a table with 7 colums and 5 rows. 1 row and 1 column has headlines. In the table i have cells with different numbers in them....
1
by: Van Dugall | last post by:
Hello I have been writing a game in javascript which works fine but I wanted to step it up and request the data of the game from the server. I haven't really used php...all I know is from the...
8
yarbrough40
by: yarbrough40 | last post by:
I'm a vb.net user mostly... can anyone tell me why I'm getting a runtime error 'permission denied' when running this? trying to get values from a dropdownlist. function getvalues() { var dl...
0
by: vivek kapile | last post by:
Title: Javascript for Adding & Removing Items from a one Listbox to another Author: Vivek Kapile Email: snipped Language: JavaScript Platform: Javascript in ASP.net...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.