# DHTML: Passing a variable a value (problem)

**URL:** <https://forum.kirupa.com/t/dhtml-passing-a-variable-a-value-problem/224209>\
**Category:** web dev\
**Created:** [April 30, 2007, 2:24am UTC](https://forum.kirupa.com/t/dhtml-passing-a-variable-a-value-problem/224209 "2007-04-30T02:24:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![digitalmatt](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalmatt/32/694_2.png) [@digitalmatt](https://forum.kirupa.com/u/digitalmatt)\
**Post date:** [April 30, 2007, 2:24am UTC](https://forum.kirupa.com/t/dhtml-passing-a-variable-a-value-problem/224209/1 "2007-04-30T02:24:07Z")

</div>

The assignment was to create an animated menu for a fictional search engine. I eventually got one to work and here it is:

[http://www.digitalmatt.net/DHTML/midterm/index2.html](http://www.digitalmatt.net/DHTML/midterm/index2.html)

Here’s the code:

```auto
var position
var intHide

        function show()
        {
        position = document.getElementById("shopmenu").style
        if (parseInt(position.top) != 30)
            {
            position = document.getElementById("shopmenu").style
            position.top = parseInt(position.top) - 10 + "px"
            }
        }
        
        function showmenu()
        
        {
        clearInterval(intHide)
        intShow = setInterval("show()",10)
        }
        
        function hide()
        {
        position = document.getElementById("shopmenu").style
        if (parseInt(position.top) < 200)
            {
            position = document.getElementById("shopmenu").style
            position.top = parseInt(position.top) + 10 + "px"
            }
        }
        
        function hidemenu()
        {
        clearInterval(intShow)
        intHide = setInterval("hide()",10)
        }

```

“Shop” is the only link with an event.

Now to get the rest of the links to use the same functions. I just simply wanted to pass the value (in this case, which DIV to slide up or down) inside the mouse events “showmenu()” and “hidemenu()” I tried it and am getting a “has no properties” error. Here it is:

[http://www.digitalmatt.net/DHTML/midterm/index3.html](http://www.digitalmatt.net/DHTML/midterm/index3.html)

Any ideas?
