?
Solved

javascript problem- hiding a textbox on rollover

Posted on 2006-05-15
12
Medium Priority
?
151 Views
Last Modified: 2012-05-05
On this page you will see the dropdown hides under the box.


http://nationalservicesscotland.com/news/nss_news.php


I use this javascript to fix the dropdown in ie

// JavaScript Document

startList = function() {
      if (document.all && document.getElementById) {
            navRoot = document.getElementById("dmenu");
            for (i=0; i < navRoot.childNodes.length; i++) {
                  node = navRoot.childNodes[i];
                  if (node.nodeName=="LI") {
                        node.onmouseover=function() {
                              this.className+=" over";
                        }
                        node.onmouseout=function() {
                              this.className=this.className.replace(" over", "");
                        }
                  }
            }
      }
}

window.onload=startList;
//-->


The menu in css looks like this


<li class="topmenuli"><a href="#" class="publications"><span style="display:none">Publications</span></a>



I need for the selectbox to be hidden when either the 'publications', 'our divisions' or 'news' node is rolled over.
0
Comment
Question by:roscoeh23
  • 5
  • 4
10 Comments
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16680813
why not try using z-index

so on the textbox have this

style="z-index:0;"

and on the menu Divs have this

style="z-index:1;"
0
 

Author Comment

by:roscoeh23
ID: 16680840
Doesn't work IE always puts the selectbox at the top regardless of the z-index.

Hope it is fixed in IE 7.

0
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16680886
so would an option be to completely hide the form control when the menu expands, thus reappearing when it contracts?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:radarsh
ID: 16680905
Hi roscoeh23,

Use an IFRAME which sits behind your menu for this.

________
radarsh
0
 

Author Comment

by:roscoeh23
ID: 16680937
I have tried the iframe and couldn't get it to work. Do you have an example?

REA_ANDREW - That is what I am trying to achieve
0
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 2000 total points
ID: 16680979
ok then well here it is.

give the select box an ID, which it will already have.

then I assume to you two methods, using the on mouse over and on mouse out.

you need to pin point three menues so you could probably give those three menu li's and id too so of the ones you want to change try this

<li id="SPECIAL" class="topmenuli"><a href="#" class="publications"><span style="display:none">Publications</span></a>

so in your javascript you could have something like this

               if (node.nodeName=="LI" && node.id=="SPECIAL") {
                    node.onmouseover=function() {
                         this.className+=" over";
document.getElementById("Your_Select_ID_Here").style.display='none';
                    }
                    node.onmouseout=function() {
                         this.className=this.className.replace(" over", "");
document.getElementById("Your_Select_ID_Here").style.display='';
                    }
               }
0
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16680987
I did not finish my post. Doh, so anyway put this else onto the if statment
else{
  node.onmouseover=function() {
                         this.className+=" over";
                    }
                    node.onmouseout=function() {
                         this.className=this.className.replace(" over", "");
                    }
}
0
 

Author Comment

by:roscoeh23
ID: 16681062
sweet!
0
 

Author Comment

by:roscoeh23
ID: 16681066
will give it a go and get back to you
0
 
LVL 20

Expert Comment

by:REA_ANDREW
ID: 16790036
Hi,

Do you require further assistance with this?

Andrew
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question