www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Popup box on mouseover

  1. #1
    Join Date
    Oct 2009
    Posts
    8

    resolved [RESOLVED] Popup box on mouseover

    Hi,

    I have previously used some code to display a popup box when a person mouses over a hyperlink. I'm trying to use a similar technique while building a html table as a string within javascript (based on dynamic data).

    I've enclosed an example of the kind of thing I'm trying to do here, but can anyone please tell me why the mouseover/mouseout isn't showing and hiding the content of the popup?

    Many thanks for any suggestions or advice.

    Gary
    Code:
    <html>
    <head>
    </head>
    <body>
    	<div id="SpecAssignOC" style="display:none; position:absolute; border-style: solid; background-color: #FFCC66; 
          padding: 5px; left:501px; top:1054px; visibility:visible; width:100px;  height:160px; z-index:1" align="center">
    <font size="2">This is on call data</font> 
    </div>
    
    <Script type="text/JavaScript">
    
    function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
    }
    function ShowContent(d,rset,uset) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd,rset,uset);
    dd.style.display = "block";
    }
    
    function specassigncells() {
    if (tarr[5]=='')
    {str+='<td>&nbsp;</td>';}
    else 
    {str+='<td><font color="#FF0000"><a onmouseover="ShowContent('+'"SpecAssignOC"'+'650,500); return true;" onmouseout="HideContent('+'"SpecAssignOC"'+'); return true;"  href="javascript:ShowContent(\'SpecAssignOC\')">*</font></td>';}
    if (tarr[6]=='')
    {str+='<td>&nbsp;</td>';}
    else 
    {str+='<td><font color="#00FF00">*</font></td>';}
    }
    
    
    var StringRecs ='Name, Unit, Scale, Day, Duty, OCS, DOS, OCE, DOE, OCT, DOT|'
    
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,22-11-2011,23:00-07:00,,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,23-11-2011,22:00-07:00,,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,24-11-2011,22:00-07:00,,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,25-11-2011,RD,23:00,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,26-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,27-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 1,1B Sergeants,Sergeant,28-11-2011,16:00-00:00,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,22-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,23-11-2011,07:00-15:00,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,24-11-2011,DIVOP,,07:00|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,25-11-2011,AL,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,26-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,27-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 2,1M Part Time - Constable,Sergeant,28-11-2011,07:00-15:00,,07:00|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,22-11-2011,07:00-17:00,07:00,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,23-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,24-11-2011,RD,,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,25-11-2011,21:00-07:00,,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,26-11-2011,21:00-07:00,,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,27-11-2011,21:00-07:00,,|'
      StringRecs = StringRecs + 'Person 3,1A Inspector,Inspector,28-11-2011,RD,,|'
    
    var Recs = StringRecs.split('|');
    var tarr = [];
    var str = '';
    str += '<table id="opTable25007" class="example table-autosort:0 table-stripeclass:alternate" border="1">';
    tarr = Recs[0].split(',');
    harr1 = Recs[1].split(',');
    harr2 = Recs[2].split(',');
    harr3 = Recs[3].split(',');
    harr4 = Recs[4].split(',');
    harr5 = Recs[5].split(',');
    harr6 = Recs[6].split(',');
    harr7 = Recs[7].split(',');
      str += '<thead><tr align="left"><th class="table-sortable:default">'+tarr[0]+'</th><th class="table-sortable:default">'
          + ['Unit','Scale',harr1[3],'c','d',harr2[3],'c','d',harr3[3],'c','d',harr4[3],'c','d',harr5[3],'c','d',harr6[3],'c','d',harr7[3],'c','d'].join('</th><th class="table-sortable:default">')+'</th></tr></thead><tbody>';
      for (var i=1; i<Recs.length-1; i=i+7) {
        str += '<tr CLASS="PortletText1">';
        tarr = Recs[i].split(',');
        str += '<td>'+tarr[0]+'</td><td>'+tarr[1]+'</td><td>'+tarr[2]+'</td>';  str += '<td>'+tarr[4]+'</td>';
    	specassigncells() 
        tarr = Recs[i+1].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        tarr = Recs[i+2].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        tarr = Recs[i+3].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        tarr = Recs[i+4].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        tarr = Recs[i+5].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        tarr = Recs[i+6].split(',');    str += '<td>'+tarr[4]+'</td>';
    	specassigncells()
        str += '</tr>';
      }
      str += '</tbody></table>';
    document.write(str) ;
    </script>
    </HTML>

  2. #2
    Join Date
    Oct 2009
    Posts
    8
    Resolved the problem myself by using some alternative 'tooltip' onmouseover code from http://dynamicdrive.com/dynamicindex5/fixedtooltip.htm
    Last edited by Low Society; 11-25-2011 at 12:58 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles