469,913 Members | 2,066 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

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:
Expand|Select|Wrap|Line Numbers
  1. tooltipShow(tooltipId, parentId, posX, posY){}
  2. tbl = document.getElementById("resultsTable");
  3. row = document.createElement("tr");
  4. cell = document.createElement("td");
  5.  
  6. 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>";
  7.                     var toolTipDiv = "<div id='fullPath" + i + "' class='tip'>" + result.data[i].EncodedVideoLocation + "</div>";
  8.                     cell.innerHTML = shortLocation + toolTipDiv;
  9.  
  10. row.appendChild(cell);
  11. tbl.appendChild(row);
  12.  
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:

Expand|Select|Wrap|Line Numbers
  1. <a href='#' id='0' style='text-decoration:none;' onmouseover="tooltipShow('fullPath0','0',0,0);" onmouseout="tooltipHide('fullPath0');" onclick='return false'>[MainDir]\HBLL\...\VarenaisBa...</a>
  2. <a href='#' id='0' style='text-decoration:none;' onmouseover="tooltipShow('fullPath0','0',0,0);" onmouseout="tooltipHide('fullPath0');" onclick='return false'>[MainDir]\HBLL\...\VarenaisBa...</a>
  3. <div id='fullPath0' class='tip'>C:\BYUgle_encoding\encoded\HBLL\LRC\VarenaisBaltijasGredzens\</div>
  4. <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.
Oct 14 '10 #1
2 1252
RamananKalirajan
607 512MB
Hi Try with this one.

Expand|Select|Wrap|Line Numbers
  1. tooltipShow(tooltipId, parentId, posX, posY){} 
  2. var tbl = document.getElementById("resultsTable"); 
  3. var rowLen = tbl.rows.length;
  4. var row1 = tbl.inertRow(rowLen);
  5. var cell1 = row1.insertCell(0); 
  6.  
  7. 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>"; 
  8.                     var toolTipDiv = "<div id='fullPath" + i + "' class='tip'>" + result.data[i].EncodedVideoLocation + "</div>"; 
  9.                     cell1.innerHTML = shortLocation + toolTipDiv; 
  10. cell1.innerHTML= shortLocation; 
  11. if(window.ActiveXObject)
  12. cell1.innerHTML = cell1.innerHTML; 
Thanks and Regards
Ramanan Kalirajan
Oct 18 '10 #2
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.
Oct 18 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Henry Jones | last post: by
3 posts views Thread by Liam Gibbs | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.