getElementById onmouseover function to style element


Quick question - not sure what I am doing wrong with the following. Thank you.

document.getElementById('collections').onmouseover = function() {



returns an array. An array does not have a .style property.

getElementsByTagName(‘ul’) is an array of elements.

If there is only one ul in the collections element use
otherwise either loop through the array and make them all visible,
or get the index from the event target

ah - ok.

Thank you very much mrhoo & 7stud.

So should:


work then for the first child ul of ‘collections’ ?

I must have something else wrong then too…

Here is a html snippet:

<li id='collections'><a href="../collections.php" class='parentLink active'>Collections</a>
<ul><li id='not-for-the-masses'><a href="../collections/collection-one.php" class='parentLink active'>Collection One</a>
<ul><li><a href="../collections/collections-one/one.php" class='active'>One</a></li>
<li><a href="../collections/collections-one/two.php">Two</a></li>
document.getElementById('collections').onmouseover = function() {

In the css the ul visibility property is set to hidden.

Does it matter that i have the id - ‘collections’ on the li parent of the ul i am trying to style - rather than a div or something else?

In the css the ul visibility property is set to hidden.

You can’t mouseover something that is hidden. The html you posted is surrounded by <ul> tags.

me = not so clever.

My problem - apart from initially attempting to style an array was that I was calling the script before the php had had a chance to create the html - so i didn’t have anything to apply my style changes to.

Thanks peeps.