[help] Needed With Java Script Language

I am in need of a code to add to this script which would make the menu go away once a mouse-down is enacted.

<script type="text/javascript">
function toggle(MenuID) {
var menu = document.getElementById(MenuID);
if (menu.style.display == 'block') {
 menu.style.display = 'none';
} else {
 menu.style.display = 'block';
}
}
</script>

Anyone

P.S. Sorry if this is in the wrong forum.

#189419

Originally posted by Duckie@Jul 14 2004, 03:18 AM-->
QUOTE(Duckie @ Jul 14 2004, 03:18 AM)
I am in need of a code to add to this script which would make the menu go away once a mouse-down is enacted.

<script type="text/javascript">function toggle(MenuID) { var menu = document.getElementById(MenuID); if (menu.style.display == 'block') {  menu.style.display = 'none'; } else {  menu.style.display = 'block'; }<!--QuoteEBegin
[b]</script>

Anyone

P.S. Sorry if this is in the wrong forum.

<{POST_SNAPBACK}>

Mouse-down... like a mouse click? Whatever container is holding the menu, e.g., a div or a span or whatever, you can add in

onClick="toggle('theid');"

So that would be like

<div id="menu1" onClick="toggle('menu1')">

If I'm understanding your question correctly... but I could be wrong so what do I know? :-)

#189437

Originally posted by pst9er@Jul 14 2004, 12:10 AM

Mouse-down... like a mouse click? Whatever container is holding the menu, e.g., a div or a span or whatever, you can add in

onClick="toggle('theid');"

So that would be like

<div id="menu1" onClick="toggle('menu1')">

If I'm understanding your question correctly... but I could be wrong so what do I know? :-)

<{POST_SNAPBACK}>

<div id="search"> 
<form action='board/index.php?act=Search&CODE=01&forums=all' method='post'>
<input type="text" name="keywords"  onfocus="this.value=''" value="Type Search Here" />
</form>
</div>

<li id="menu_search"><a onclick="toggle('search')"  href="#"></a></li>
<li></li>

I have this, but when I mouse down on the item, it stays until the next page loads

#189446

Your javascript here

then

<a href="Javascript:toggle('search');">Link</a>

Just look at the source code for how IPB 2 toggles the forum visibility.

#189479

how about adding an onSubmit to your form? that way whenever you submit the search form it should* disappear? something like this:

<script type="text/javascript">
 function hideMenu(MenuID) {
   var menu = document.getElementById(MenuID);
   if (menu.style.display != 'none') {
     menu.style.display = 'none';
   }
 }
</script>

<div id="searchdiv">
<form action="board/index.php?act=Search&CODE=01&forums=all"
method="post" onsubmit="hideMenu('searchdiv');">
<input type="text" name="keywords"  onfocus="this.value=''" value="Type Search Here" />
</form>
</div>

That way if your form gets submitted by pressing enter or by pressing the submit button it should* work

______________________

*Should: implies what my warped little mind believes. I thas not been tested and I'm not sure it will work...

#189480

*EDITTED

#189487

tell you what...go look at my apple menu on the site

therealduckie.net

now, when I click a link, it doesnt go

I used

for the menu

#189492

damn I am dumb

I changed it to onclick instead of onmouseup

works now, check it out

http://www.therealduckie.net/

MODS, YOU CAN CLOSE THIS THREAD NOW

#189497

We have a policy of not closing threads just because the problem has been solved. If you want a thread closed, you better damn well start a flame war next time.

#189533

Originally posted by contrasutra@Jul 14 2004, 08:15 AM

We have a policy of not closing threads just because the problem has been solved. If you want a thread closed, you better damn well start a flame war next time.

<{POST_SNAPBACK}>

OMG YOU SUCK ;)

Flame war started!

[ Topic Closed ]

#189548