Помогите, не работает код JS
Помогите, пожалуста, не работает выпадающее меню на JS.
Вот код JS: var brname=navigator.appName, BrVer=''; if(brname.substring(0,2)=="Mi") BrVer='E'; var timer = 0; lastid = -1; function show(id) { if(!((document.all)?document.all['menu'+id]:document.getElementById('menu'+id))) return; clearTimeout(timer); if((id != lastid) && (lastid!=-1)) ((document.all)?document.all['menu'+lastid]:document.getElementById('menu'+lastid)).style.visibility = 'hidden'; hideElement("SELECT", document.getElementById('menu'+lastid)); lastid = id; ((document.all)?document.all['menu'+lastid]:document.getElementById('menu'+lastid)).style.visibility = 'visible'; } function hidden(id) { if(!((document.all)?document.all['menu'+id]:document.getElementById('menu'+id))) return; showElement("SELECT"); timer = setTimeout("if('"+id+"' == '"+lastid+"'){((document.all)?document.all['menu"+lastid+"']:document.getElementById('menu"+lastid+"')).style.visibility = 'hidden';}", 500) } function GetPos(el) { if (!el || !el.offsetParent)return false; var res=Array() res["left"] = el.offsetLeft; res["top"] = el.offsetTop; var objParent = el.offsetParent; while (objParent.tagName.toUpperCase()!="BODY") { res["left"] += objParent.offsetLeft; res["top"] += objParent.offsetTop; objParent = objParent.offsetParent; } res["right"]=res["left"]+el.offsetWidth; res["bottom"]=res["top"]+el.offsetHeight; return res; } function hideElement(elName, Menu) { if(BrVer!='E') return; for (i = 0; i < document.all.tags(elName).length; i++) { Obj = document.all.tags(elName)[i]; if(!(pMenu=GetPos(Menu)))continue; if(!(pObj=GetPos(Obj)))continue; if(pObj["left"]<pMenu["right"] && pMenu["left"]<pObj["right"] && pObj["top"]<pMenu["bottom"] && pMenu["top"]<pObj["bottom"]) Obj.style.visibility = "hidden"; } } function showElement(elName) { if(BrVer!='E') return; for (i = 0; i < document.all.tags(elName).length; i++) { obj = document.all.tags(elName)[i]; if (!obj || !obj.offsetParent)continue; if(obj.style.visibility=="hidden") obj.style.visibility = "visible"; } } Вот код HTML: <table border="0" cellspacing="0" cellpadding="0" style="height: 100%" width="142px"> <tr> <td onmouseover="show(3)" onmouseout="hidden(3)" id="menu_bg2"> <a href="portfolio.shtml" style="text-decoration: none;"> <img src="images/menu5.gif" border=0 height="29px" style="height: 100%; padding: 0px; margin: 0px;"> </a> </td> </tr> </table> <div style="position:relative;"> <div onMouseOver="show(3)" onMouseOut="hidden(3)" id="menu3" style="visibility: hidden; position: absolute; z-index: +1; top: 0px;" > <table border="0" cellspacing="0" cellpadding="0" width="142px" style="border: 1px solid #D7D7D7"> <tr> <td bgcolor="#E6EFF7" valign="top" style="border-bottom: 1px solid #D7D7D7"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td nowrap onmouseover="this.className='popupmenuact_first'" onmouseout="this.className='popupmenu_first'" onclick="window.location='portfolio1.shtml'" class="popupmenu_first" style="cursor: hand"> <nobr><a href="portfolio1.shtml" style="text-decoration: none;" class="popupmenutext"> Фасовочные пакеты </a></nobr> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#E6EFF7" valign="top" style="border-bottom: 1px solid #D7D7D7"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td nowrap onmouseover="this.className='popupmenuact'" onmouseout="this.className='popupmenu'" onclick="window.location='portfolio2.shtml'" class="popupmenu" style="cursor: hand"> <nobr><a href="portfolio2.shtml" style="text-decoration: none;"> <font class="popupmenutext">Пакеты типа "Майка"</font> </a></nobr> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#E6EFF7" valign="top" style="border-bottom: 1px solid #D7D7D7"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td nowrap onmouseover="this.className='popupmenuact'" onmouseout="this.className='popupmenu'" onclick="window.location='portfolio3.shtml'" class="popupmenu" style="cursor: hand"> <nobr><a href="portfolio3.shtml" style="text-decoration: none;"> <font class="popupmenutext">Пакеты с прорубной ручкой <br>(не усиленной)</font> </a></nobr> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#E6EFF7" valign="top" style="border-bottom: 1px solid #D7D7D7"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td nowrap onmouseover="this.className='popupmenuact'" onmouseout="this.className='popupmenu'" onclick="window.location='portfolio4.shtml'" class="popupmenu" style="cursor: hand"> <nobr><a href="portfolio4.shtml" style="text-decoration: none;"> <font class="popupmenutext">Пакеты с прорубной ручкой <br>(усиленной)</font> </a></nobr> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#E6EFF7" valign="top" style="border-bottom: 1px solid #D7D7D7"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr valign="top"> <td nowrap onmouseover="this.className='popupmenuact'" onmouseout="this.className='popupmenu'" onclick="window.location='portfolio5.shtml'" class="popupmenu" style="cursor: hand"> <nobr><a href="portfolio5.shtml" style="text-decoration: none;"> <font class="popupmenutext">Пакеты с петлевой ручкой</font> </a></nobr> </td> </tr> </table> </td> </tr> </table> </div> </div> ОЧЕНЬ прошу помощи, буду ОЧЕНЬ благодарен!!! |
Пожалуйста, отформатируйте свой код!
Для этого его можно заключить в специальные теги: js/css/html и т.п., например: [js] ... ваш код... [/js] О том, как вставить в сообщение исполняемый javascript и html-код, а также о дополнительных возможностях форматирования - читайте http://javascript.ru/formatting. |
melky, сделал! Помогите кто-нибудь!
|
"Не работает выпадающее меню" и такая тонна кода - это что-то абстрактное. Локализуйте сперва проблему.
|
Часовой пояс GMT +3, время: 12:15. |