/    Sign up×
Community /Pin to ProfileBookmark

Unable To View Option Of Menu When Menu Option Comes On select Box in I.E

Hi all,
I am adding options to menu using javascript. When Menu size increases, if option is comes on select box I am unable to see that option of Menu.
But I can I able to see the option if it comes Text box.
But I can see the menu option in mozila and netscape.
Why It is happening like this.
I am sending the code also.
Can any one please tell the solution?
Thanks in advance.
Regards,
Subbarao

I am sending the code also

<html>
<head>
<script type=”text/javascript”>
var menu1=new Array()
for (i = 0;i < 10;i++)
menu1[i]='<a href=”#”;><font color=”black”>i</font></a>’

var menuwidth=’165px’ //default menu width
var menubgcolor=’white’ //menu bgcolor
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick=”yes” //hide menu when user clicks within menu?

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write(‘<div id=”dropmenudiv” style=”visibility:hidden;width:’+menuwidth+’;background-color:’+menubgcolor+'” onMouseover=”clearhidemenu()” onMouseout=”dynamichide(event)”></div>’)

function getposOffset(what, offsettype){
var totaloffset=(offsettype==”left”)? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype==”left”)? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=””){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type==”click” && obj.visibility==hidden || e.type==”mouseover”)
obj.visibility=visible
else if (e.type==”click”)
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!=”BackCompat”)? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge==”rightedge”){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join(“”)
}

function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById(“dropmenudiv”) : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, “visible”, “hidden”, menuwidth)
dropmenuobj.x=getposOffset(obj, “left”)
dropmenuobj.y=getposOffset(obj, “top”)
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, “rightedge”)+”px”
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, “bottomedge”)+obj.offsetHeight+”px”
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!=”undefined”){
if (ie4||ns6)
dropmenuobj.style.visibility=”hidden”
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout(“hidemenu()”,disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!=”undefined”)
clearTimeout(delayhide)
}

if (hidemenu_onclick==”yes”)
document.onclick=hidemenu

</script>

<style type=”text/css”>

#dropmenudiv{

border-left:1px solid black; border-right:1px solid black; border-top:1px solid black; border-bottom:0px solid black; position:absolute;
line-height:18px;
z-index:100; font-style:normal; font-variant:normal; font-weight:normal; font-size:12px; font-family:Verdana
}

#dropmenudiv a{
width: 100%;

display: block;
text-indent: 3px;
border-bottom: 1px solid black;
text-decoration: none;
font-weight:; padding-left:0; padding-right:0; padding-top:1px; padding-bottom:1px
}

#dropmenudiv a:hover{
}
</style>

</head>

<body bgcolor=”#F7F7F7″ topmargin=”0″ leftmargin=”0″>

<form name=”frmStatisticMenu” method=”POST” action =”” >

<table border=”0″ cellpadding=”0″ cellspacing=”0″ style=”border-collapse: collapse” bordercolor=”#111111″ width=”100%” id=”AutoNumber1″ height=”39″>

<tr>

<td width=”82%” height=”19″ valign=”top” >

<table width=”500″ border=”0″>

<tr align=”left”>
<td width=”25%” align=”left” nowrap >
<a onMouseover=”return dropdownmenu(this, event, menu1, ‘100px’)” onMouseout=”delayhidemenu()”>

<font Color=Black class=”pt11″>Menu</font>&nbsp;

</tr>

</table>

<TABLE border=”0″ height=”90″ cellpadding=”0″ cellspacing=”5″ style=”border-collapse: collapse” bordercolor=”#111111″ width=”769″>

<TR valign=”top”>
<TD><br><br></TD>

</TR>

<tr align=”left”>

<td colspan=”2″>

<select name=”messegeType” style=”width: 25%”>
</td>

</tr>
<tr> <td> <input type=”text”></td></tr>

</TABLE>
</td>
</tr>
</table>

</form>

</body>
</html>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 02.2005 — The select is a special window element in IE and will always appear above other elements.

You can solve it by placing the form in an iframe or hiding the form when the menu appears.
×

Success!

Help @subbarao spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...