W
webdeveloper
sorry about that,
This is the event handling element:
<div id="menu">
<ul>
<li>....
<li><a
href="javascript:expand_menu(document.getElementById('extend'))"
id="extend">Text <img src="" id="arrow" src="arro-u.gif"> </a>
<ul>
<li>......</li>....</ul></div>
Once that linked is clicked on, it's supposed to expand the menu
below, as well as swap the image, simultaneously.
It's what happens in FF. But in IE it takes 2 clicks, one for the
image to swap, another for the menu to expand. But only on the first
click. On any subsequent clicks, only one click is needed for both
functions to fire even in IE. But now the image displayed is the wrong
one.
These are the functions:
onload=function()
{document.getElementById("menu").getElementsByTagName("ul")
[1].setAttribute("style","display:none;")
} //just to ensure the inline style attribute, don't remember why it
was necessary
function swap_img() { //function to swap the image inside the <a>
m=document.images.arrow;
if(m.src.indexOf("arrow-u")>0) {
m.src=m.src.replace(/arrow-u/,"arrow-d");
}
else {
m.src=m.src.replace(/arrow-d/,"arrow-u");
}
}
function expand_menu(node) { //function to expand the menu div
drop=node.parentNode || node.parentElement;
kids=drop.childNodes[2];
if(kids.nodeName.toLowerCase()=="ul"&&kids.style.display=="none") {
kids.style.display="block";
}
else {
kids.style.display="none";
}
swap_img(); //the image swap function above is called from this
function
}
Hope that wasn't too cluttered thanks for any help.
This is the event handling element:
<div id="menu">
<ul>
<li>....
<li><a
href="javascript:expand_menu(document.getElementById('extend'))"
id="extend">Text <img src="" id="arrow" src="arro-u.gif"> </a>
<ul>
<li>......</li>....</ul></div>
Once that linked is clicked on, it's supposed to expand the menu
below, as well as swap the image, simultaneously.
It's what happens in FF. But in IE it takes 2 clicks, one for the
image to swap, another for the menu to expand. But only on the first
click. On any subsequent clicks, only one click is needed for both
functions to fire even in IE. But now the image displayed is the wrong
one.
These are the functions:
onload=function()
{document.getElementById("menu").getElementsByTagName("ul")
[1].setAttribute("style","display:none;")
} //just to ensure the inline style attribute, don't remember why it
was necessary
function swap_img() { //function to swap the image inside the <a>
m=document.images.arrow;
if(m.src.indexOf("arrow-u")>0) {
m.src=m.src.replace(/arrow-u/,"arrow-d");
}
else {
m.src=m.src.replace(/arrow-d/,"arrow-u");
}
}
function expand_menu(node) { //function to expand the menu div
drop=node.parentNode || node.parentElement;
kids=drop.childNodes[2];
if(kids.nodeName.toLowerCase()=="ul"&&kids.style.display=="none") {
kids.style.display="block";
}
else {
kids.style.display="none";
}
swap_img(); //the image swap function above is called from this
function
}
Hope that wasn't too cluttered thanks for any help.