Witam. Mam skrypcik rozsuwanego menu w js i css. Kod:
Kod
//menu.js
function Menu(id, style, otworz, wysun, czasRozwin, czasZwin, czasOtworz, czasZamknij, nieInicjalizuj)
{
if (typeof czasRozwin == 'undefined' || czasRozwin < 0) czasRozwin = 25;
if (typeof czasZwin == 'undefined' || czasZwin < 0) czasZwin = 25;
if (typeof czasOtworz == 'undefined' || czasOtworz < 0) czasOtworz = 250;
if (typeof czasZamknij == 'undefined' || czasZamknij < 0) czasZamknij = 500;

if (style)
{
  if (style.indexOf(':') < 0)
  {
   document.getElementById(id).className += ' ' + style;
  }
  else
  {
   style = style.replace(/(^\s+|(\s|;)+$)/g, '').split(/\s*;\s*/);
   for (var i = 0; i < style.length; i++)
   {
    style[i] = style[i].split(/\s*:\s*/);
    for (var j = 0, c, property = ''; j < style[i][0].length; j++)
    {
     c = style[i][0].charAt(j);
     property += c == '-' ? style[i][0].charAt(++j).toUpperCase() : c.toLowerCase();
    }
    eval('document.getElementById("' + id + '").style.' +
property + ' = "' + style[i][1].replace(/"/g, '\\"') + '"');
   }
  }
}

for (var i = 0; i < document.getElementById(id).getElementsByTagName('dt').length; i++)
{
  var dd = new Array();
  var el = document.getElementById(id).getElementsByTagName('dt')[i].nextSibling;
  var nodeName;
  while (el && (nodeName = el.nodeName.toLowerCase()) != 'dt')
  {
   if (nodeName == 'dd')
   {
    el._dt = document.getElementById(id).getElementsByTagName('dt')[i];
    if (otworz)
    {
     el.onmouseover = function()
     {
      clearTimeout(this._dt._timoutID);
      this._dt._displayed = false;
      this._dt.onclick();
     }
     el.onmouseout = function()
     {
      clearTimeout(this._dt._timoutID);
      var dt = this._dt;
      this._dt._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
     };
    }
    dd[dd.length] = el;
   }
   el = el.nextSibling;
  }
  document.getElementById(id).getElementsByTagName('dt')[i]._dd = dd;
  document.getElementById(id).getElementsByTagName('dt')[i]._timoutID = null;
  document.getElementById(id).getElementsByTagName('dt')[i]._displayed = false;
  document.getElementById(id).getElementsByTagName('dt')[i].onclick = function()
  {
   clearTimeout(this._timoutID);
   if (!this._displayed)
   {
    var el = this.parentNode.getElementsByTagName('dt')[0];
    while (el)
    {
     if (el.nodeName.toLowerCase() == 'dt' && el != this)
     {
      el._displayed = false;
      if (czasZwin) display(el, 0);
      else display(el);
     }
     el = el.nextSibling;
    }
   }
   this._displayed = !this._displayed;
   if (this._displayed && czasRozwin || !this._displayed && czasZwin) display(this, 0);
   else display(this);
  };
  if (otworz)
  {
   document.getElementById(id).getElementsByTagName('dt')[i].onmouseover = function()
   {
    clearTimeout(this._timoutID);
    var dt = this;
    this._timoutID = setTimeout(function () { dt._displayed = false; dt.onclick(); }, czasOtworz);
   };
   document.getElementById(id).getElementsByTagName('dt')[i].onmouseout = function()
   {
    clearTimeout(this._timoutID);
    var dt = this;
    this._timoutID = setTimeout(function () { dt._displayed = true; dt.onclick(); }, czasZamknij);
   };
  }
}

start(document.getElementById(id).getElementsByTagName('dt')[0]);

function start(dt)
{
  var hide = true;
  var el = dt;
  while (el)
  {
   var nodeName = el.nodeName.toLowerCase();
   if (nodeName == 'dt')
   {
    dt = el;
    hide = true;
   }
   if (nodeName == 'dt' || nodeName == 'dd')
   {
    if (!nieInicjalizuj &&
el.getElementsByTagName('a').length &&
el.getElementsByTagName('a')[0].href &&
unescape(el.getElementsByTagName('a')[0].href) ==
unescape(window.location.href))
    {
     el.className = (el.className ? el.className + ' ' : '') + 'active';
     dt._displayed = true;
     display(dt);
     hide = false;
     var el_parentNode = el.parentNode;
     while (el_parentNode != document.getElementById(id))
     {
      if (el_parentNode.nodeName.toLowerCase() == 'dd')
      {
       var el_sibling = el_parentNode.previousSibling;
       while (el_sibling)
       {
        if (el_sibling.nodeName.toLowerCase() == 'dt')
        {
         el_sibling._displayed = true;
         display(el_sibling)
         break;
        }
        el_sibling = el_sibling.previousSibling;
       }
      }
      el_parentNode = el_parentNode.parentNode;
     }
    }
   }
   if (nodeName == 'dd')
   {
    if (hide) el.style.display = 'none';
    start(el.getElementsByTagName('dt')[0]);
   }
   el = el.nextSibling;
  }
}

function display(dt, i)
{
  if (typeof i == 'undefined')
  {
   for (var i = 0; i < dt._dd.length; i++)
   {
    dt._dd[i].style.display = dt._displayed ? 'block' : 'none';
    if (!dt._displayed)
    {
     for (var j = 0; j < dt._dd[i].getElementsByTagName('dt').length; j++)
     {
      dt._dd[i].getElementsByTagName('dt')[j]._displayed = false;
      display(dt._dd[i].getElementsByTagName('dt')[j]);
     }
    }
   }
  }
  else if (i < dt._dd.length)
  {
   var dir = wysun ? !dt._displayed : dt._displayed;
   var n = dir ? i : dt._dd.length - 1 - i;
   dt._dd[n].style.display = dt._displayed ? 'block' : 'none';
   if (!dt._displayed)
   {
    for (var j = 0; j < dt._dd[n].getElementsByTagName('dt').length; j++)
    {
     dt._dd[n].getElementsByTagName('dt')[j]._displayed = false;
     display(dt._dd[n].getElementsByTagName('dt')[j]);
    }
   }
   dt._timoutID = setTimeout(function() { display(dt, i + 1); }, dt._displayed ? czasRozwin : czasZwin);
  }
}
}


  1. <?php
  2. include('../functions.php');
  3. if(empty($_GET['v'])){
  4. header("Location: index.php");
  5. }
  6. $zapytanie = mysql_query("SELECT * FROM `filmy` WHERE `ID` = '".addslashes($_GET['v'])."'");
  7. $row = mysql_fetch_array($zapytanie);
  8. $szer = "425";
  9. $wys = "355";
  10.  
  11. $films = mysql_query("SELECT * FROM `filmy` WHERE `dodal` = '".$row[2]."' ORDER BY `ID` DESC");
  12. $ilosc_filmow_usera = mysql_num_rows($films);
  13.  
  14.  echo('<html><head>
  15.  <script type="text/javascript" src="menu.js"></script>
  16. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
  17. <link rel="stylesheet" href="../style.css" type="text/css"></head>
  18. <table class="tabela" cellpadding="0" cellspacing="1" align="center" border="1">
  19. <tr>
  20. <th colspan="3" class="logo"></th>
  21.  
  22. </tr>
  23. <tr>
  24. <th class="naglowek">'.$row[1].'</th>
  25. <th rowspan="3" valign="top"><table align="right" class="tabela5" cellpadding="0" cellspacing="0">
  26. <tr><th width="10">&nbsp;Dodał:&nbsp;</th><th>'.$row[2].'</th></tr>
  27. <tr><th width="10">&nbsp;Filmy:&nbsp;</th><th>'.$ilosc_filmow_usera.'</th></tr>
  28. <tr><th width="10">&nbsp;Dodano:&nbsp;</th><th>'.$row[3].'</th></tr>
  29. <tr><th width="10">&nbsp;Kategoria:&nbsp;</th><th>'.$kategoria.'</th></tr>
  30. <tr><th width="10">&nbsp;URL:&nbsp;</th><th><input type="url" value="http://townoflaugh.pl'.$_SERVER['REQUEST_URI'].'" class="url"/></th></tr>
  31. <tr><th colspan="2"><font color="#FFFFFF"><dl id="menu0"><dt>a</dt><dd>b</dd><dd>c</dd><dt>Więcej od usera</dt></font>
  32. '); 
  33. $i = 0;
  34. while($row = mysql_fetch_array($films)){
  35. $i++;
  36. if($i <= 10){
  37. echo('<dd><img src="http://i.ytimg.com/vi/'.$row[5].'/default.jpg" width="90%" height="90%"/><a href="video.php?v='.$row[0].'">'.$row[1].'</a></dd>');
  38. }
  39. }
  40. echo("</dl></th></tr><script type=\"text/javascript\">
  41. // <![CDATA[
  42. new Menu('menu0');
  43. // ]]>
  44. </script>");
  45. echo('
  46. </table></th>
  47. </tr>
  48. <tr>
  49. <th width="'.$szer.'" height="'.$wys.'" valign="top">'.$echo.'</th>
  50. </tr>
  51. <tr><th>Komentarze</th></tr>
  52. </table>
  53. </html>');
  54. ?>

Problem polega na tym, że po wczytaniu strony menu o nazwie 'a' jest schowane a menu o nazwie 'wiecej od usera' jest rozciagniete. Co zrobić aby menu 'wiecej od usera' bylo schowane?

PS.

Zauważyłem, że bez zmiennych działa, a ze zmiennymi nie czyli jezeli skasuje zmienne z <dd> to działa i w dodatku zmienna ta jest w linku czyli w tym wypadku $row[0] i gdy $row[0] zmienie na $row[1] to działa. $row[0] to ID filmu wiec nie wiem w czym jest problem