Weird things with .innerHTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jordana309
    New Member
    • Apr 2007
    • 5

    Weird things with .innerHTML

    Ok, so I'm having some really weird problems. I will try to abstractly explain the problem, as the amount of code involved will be silly to paste in here.

    So, I have a <script> tag that pulls in a toolTip js file. That works just fine with static text on my page. But, I have a table that refreshes out of a database, so every so many seconds, I completely rebuild the table using [CODE].appendChild[.CODE].

    For whatever reason, the js calls for the toolTips no longer shows up inside the table. Here's the code for that section:
    Code:
    tooltipShow(tooltipId, parentId, posX, posY){}
    tbl = document.getElementById("resultsTable");
    row = document.createElement("tr");
    cell = document.createElement("td");
    
    shortLocation = "<a href='#' id='" + i + "' style='text-decoration:none;' onmouseover=\"tooltipShow('fullPath" + i + "','" + i + "',0,0);\" onmouseout=\"tooltipHide('fullPath" + i + "');\" onclick='return false'>[MainDir]\\" + department + "...\\" + shortMovName + "</a>";
    					var toolTipDiv = "<div id='fullPath" + i + "' class='tip'>" + result.data[i].EncodedVideoLocation + "</div>";
    					cell.innerHTML = shortLocation + toolTipDiv;
    
    row.appendChild(cell);
    tbl.appendChild(row);
    The output looks like this (my static, written link that works with the tooltip is the top line, the generated stuff is the bottom line:

    Code:
    <a href='#' id='0' style='text-decoration:none;' onmouseover="tooltipShow('fullPath0','0',0,0);" onmouseout="tooltipHide('fullPath0');" onclick='return false'>[MainDir]\HBLL\...\VarenaisBa...</a>
    <a href='#' id='0' style='text-decoration:none;' onmouseover="tooltipShow('fullPath0','0',0,0);" onmouseout="tooltipHide('fullPath0');" onclick='return false'>[MainDir]\HBLL\...\VarenaisBa...</a>
    <div id='fullPath0' class='tip'>C:\BYUgle_encoding\encoded\HBLL\LRC\VarenaisBaltijasGredzens\</div>
    <div id='fullPath0' class='tip'>C:\BYUgle_encoding\encoded\HBLL\LRC\VarenaisBaltijasGredzens\</div>
    They are exactly identical. Why will the tooltip not work on the code pulled and generated by my js?

    EDIT: I just discovered that having "onclick=alert( 'words');" didn't work, either. Nothing that requires user input works here. Another clencher? I'm using Adobe AIR to write this.
  • RamananKalirajan
    Contributor
    • Mar 2008
    • 608

    #2
    Hi Try with this one.

    Code:
    tooltipShow(tooltipId, parentId, posX, posY){} 
    var tbl = document.getElementById("resultsTable"); 
    var rowLen = tbl.rows.length;
    var row1 = tbl.inertRow(rowLen);
    var cell1 = row1.insertCell(0); 
      
    shortLocation = "<a href='#' id='" + i + "' style='text-decoration:none;' onmouseover=\"tooltipShow('fullPath" + i + "','" + i + "',0,0);\" onmouseout=\"tooltipHide('fullPath" + i + "');\" onclick='return false'>[MainDir]\\" + department + "...\\" + shortMovName + "</a>"; 
                        var toolTipDiv = "<div id='fullPath" + i + "' class='tip'>" + result.data[i].EncodedVideoLocation + "</div>"; 
                        cell1.innerHTML = shortLocation + toolTipDiv; 
    cell1.innerHTML= shortLocation; 
    if(window.ActiveXObject)
    cell1.innerHTML = cell1.innerHTML;
    Thanks and Regards
    Ramanan Kalirajan
    Last edited by RamananKalirajan; Oct 18 '10, 08:55 AM. Reason: Changed row to row1 and cell to cell1

    Comment

    • jordana309
      New Member
      • Apr 2007
      • 5

      #3
      Thanks Ramanan, but that didn't work either. I'm not sure exactly what is going on, here. I'm going to check the scope of my functions and see that's the problem.

      Comment

      Working...