HI all
This script is giving me an error getElementById is not an object or null
[CODE=javascript]
sfHover = function() {
// Support the standard nav without a class of nav.
var el = document.getEle mentById("nav") ;
if(!/\bnav\b/.test(el.classN ame) && el.tagName == "UL")
setHover(el);
// Find all unordered lists.
var ieNavs = document.getEle mentsByTagName( 'ul');
for(i=0; i<ieNavs.length ; i++) {
var ul = ieNavs[i];
// If they have a class of nav add the menu hover.
if(/\bnav\b/.test(ul.classN ame))
setHover(ul);
}
}
function setHover(nav) {
var ieULs = nav.getElements ByTagName('ul') ;
if (navigator.appV ersion.substr(2 2,3)!="5.0") {
// IE script to cover <select> elements with <iframe>s
for (j=0; j<ieULs.length ; j++) {
var ieMat=document. createElement(' iframe');
if(document.loc ation.protocol == "https:")
ieMat.src="//0";
else if(window.opera != "undefined" )
ieMat.src="";
else
ieMat.src="java script:false";
ieMat.scrolling ="no";
ieMat.frameBord er="0";
ieMat.style.wid th=ieULs[j].offsetWidth+"p x";
ieMat.style.hei ght=ieULs[j].offsetHeight+" px";
ieMat.style.zIn dex="-1";
ieULs[j].insertBefore(i eMat, ieULs[j].childNodes[0]);
ieULs[j].style.zIndex=" 101";
}
// IE script to change class on mouseover
var ieLIs = nav.getElements ByTagName('li') ;
for (var i=0; i<ieLIs.length ; i++) if (ieLIs[i]) {
// Add a sfhover class to the li.
ieLIs[i].onmouseover=fu nction() {
if(!/\bsfhover\b/.test(this.clas sName))
this.className+ =" sfhover";
}
ieLIs[i].onmouseout=fun ction() {
if(!this.contai ns(event.toElem ent))
{
this.className= this.className. replace(' sfhover', '');
}
}
}
} else {
// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
// IE script to change class on mouseover
var ieLIs = document.getEle mentById('nav') .getElementsByT agName('li');
for (var i=0; i<ieLIs.length ; i++) if (ieLIs[i]) {
ieLIs[i].onmouseover=fu nction() {this.className +=" sfhover";hideSe lects();}
ieLIs[i].onmouseout=fun ction() {this.className =this.className .replace(' sfhover', '');showSelects ()}
}
}
}
// If IE 5.0 hide and show the select statements.
function hideSelects(){
var oSelects=docume nt.getElementsB yTagName("selec t");
for(var i=0;i<oSelects. length;i++)
oSelects[i].className+=" hide";
}
function showSelects(){
var oSelects=docume nt.getElementsB yTagName("selec t");
for(var i=0;i<oSelects. length;i++)
oSelects[i].className=oSel ects[i].className.repl ace(" hide","");
}
// Run this only for IE.
if (window.attachE vent) window.attachEv ent('onload', sfHover);
// end[/CODE]
Can anyone pls help me?
manisha.
This script is giving me an error getElementById is not an object or null
[CODE=javascript]
sfHover = function() {
// Support the standard nav without a class of nav.
var el = document.getEle mentById("nav") ;
if(!/\bnav\b/.test(el.classN ame) && el.tagName == "UL")
setHover(el);
// Find all unordered lists.
var ieNavs = document.getEle mentsByTagName( 'ul');
for(i=0; i<ieNavs.length ; i++) {
var ul = ieNavs[i];
// If they have a class of nav add the menu hover.
if(/\bnav\b/.test(ul.classN ame))
setHover(ul);
}
}
function setHover(nav) {
var ieULs = nav.getElements ByTagName('ul') ;
if (navigator.appV ersion.substr(2 2,3)!="5.0") {
// IE script to cover <select> elements with <iframe>s
for (j=0; j<ieULs.length ; j++) {
var ieMat=document. createElement(' iframe');
if(document.loc ation.protocol == "https:")
ieMat.src="//0";
else if(window.opera != "undefined" )
ieMat.src="";
else
ieMat.src="java script:false";
ieMat.scrolling ="no";
ieMat.frameBord er="0";
ieMat.style.wid th=ieULs[j].offsetWidth+"p x";
ieMat.style.hei ght=ieULs[j].offsetHeight+" px";
ieMat.style.zIn dex="-1";
ieULs[j].insertBefore(i eMat, ieULs[j].childNodes[0]);
ieULs[j].style.zIndex=" 101";
}
// IE script to change class on mouseover
var ieLIs = nav.getElements ByTagName('li') ;
for (var i=0; i<ieLIs.length ; i++) if (ieLIs[i]) {
// Add a sfhover class to the li.
ieLIs[i].onmouseover=fu nction() {
if(!/\bsfhover\b/.test(this.clas sName))
this.className+ =" sfhover";
}
ieLIs[i].onmouseout=fun ction() {
if(!this.contai ns(event.toElem ent))
{
this.className= this.className. replace(' sfhover', '');
}
}
}
} else {
// IE 5.0 doesn't support iframes so hide the select statements on hover and show on mouse out.
// IE script to change class on mouseover
var ieLIs = document.getEle mentById('nav') .getElementsByT agName('li');
for (var i=0; i<ieLIs.length ; i++) if (ieLIs[i]) {
ieLIs[i].onmouseover=fu nction() {this.className +=" sfhover";hideSe lects();}
ieLIs[i].onmouseout=fun ction() {this.className =this.className .replace(' sfhover', '');showSelects ()}
}
}
}
// If IE 5.0 hide and show the select statements.
function hideSelects(){
var oSelects=docume nt.getElementsB yTagName("selec t");
for(var i=0;i<oSelects. length;i++)
oSelects[i].className+=" hide";
}
function showSelects(){
var oSelects=docume nt.getElementsB yTagName("selec t");
for(var i=0;i<oSelects. length;i++)
oSelects[i].className=oSel ects[i].className.repl ace(" hide","");
}
// Run this only for IE.
if (window.attachE vent) window.attachEv ent('onload', sfHover);
// end[/CODE]
Can anyone pls help me?
manisha.
Comment