Link to home
Start Free TrialLog in
Avatar of eteran
eteranFlag for United States of America

asked on

Need help with this script.

I created this code with the exception of some help with the pros of this site. What I need is on each sub link no matter where the user presses, so long as on the same line it will link to the page on the word. Another feature I am trying to add to this is a feature in which the mouse moves out of the range it should hide the box. Just cut and paste this to your editor and run you will see what I am talking about. Thank you for your time.


<style type="text/css"> <!--
.submenuStyle {
   position: absolute;
   visibility: hidden;
}
.menuStyle {
    visibility: visable;
}
.m
{
   FONT-SIZE: 12;
   COLOR: #444444;
   FONT-FAMILY: Arial;
   font style: BOLD;
   TEXT-DECORATION: none
}
//--></style>

<script language="JavaScript"><!--

  // How many pixels to adjust down:
 var steps = 20;
 // How many total items untill the table is splits:
 var split = 10;
 // How many pixels to adjust left:
 var rsteps = 6;
 
 
 // Try these for vertical menus:
 // var steps = -6;
 // How many total items untill the table is splits:
 // var split = 200     ;
 // How many pixels to adjust left:
 // var rsteps = -74;

// Create new main array.
var menuitems =      [["popup:email_cdo.asp", "Add Message", "StaffEmail.asp", "View Email","faxlogin.asp","Fax Center"],
                               ["staffemployeebook.asp", "Employee Phone Book","Staffeditprofile.asp", "Edit Profile"],
                               ["HTTP://SEF.MLXCHANGE.COM", "MLS", "HTTP://MIAMIRE.COM", "Board of Realtors", "StaffFinancial.asp", "Financial Calculator", "staffzipform.asp","Create Contract"],
                             ["Staffviewofficelisting.asp", "Office Listings","staffaddofficelisting.asp", "Add Office Listing"],
                   ["staffaddtransaction.asp","Add Transaction","staffviewactive.asp?ID=Active", "Active Pipeline", "staffviewactive.asp?ID=Closed", "Closed Pipeline", "staffviewactive.asp?ID=Dropped", "Dropped Pipeline", "StaffTransactionreport.asp", "Report"],
                        ["popup:staffaddlead.html", "Add Lead","staffleadviewer.asp", "Office Leads", "StaffMyleadviewer.asp", "My Leads", "popup:Staffaddmylead.html","Add My Lead"]]

//LIST ITEMS YOU WANT TO OPEN UP IN A NEW WINDOW HERE
var newWin=new Array("HTTP://SEF.MLXCHANGE.COM","MLS","HTTP://MIAMIRE.COM", "Board of Realtors");

//Generate Span Layers
function generate_layers()
{
  newWin="|"+newWin.join("|")+"|";
 var x=0;
  browser_type = navigator.appName;

  for (x=0; x< menuitems.length; x++)
       {
          if (browser_type ==  "Microsoft Internet Explorer") {
          document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle style="z-index:1;">');
         }
         else {
         document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle>');
         }          
         document.writeln ('<table border=1 bgcolor=#ffffff bordercolor=#89AE79 cellspacing=0 cellpadding=5><tr><td valign=top>')
          var intmaxsplit = 50
              if ((menuitems[x].length/5) > (split/2)) {
               var intmaxsplit = (menuitems[x].length/2)
               if  (((intmaxsplit) % 2) == 0.5) {var intmaxsplit = intmaxsplit + 1;}
               }

             for (xx=0; xx< menuitems[x].length; xx++)
            {
             
                  if (browser_type ==  "Microsoft Internet Explorer") {
              document.writeln ('<TABLE width=114 border=0 cellspacing=0 cellpadding=0><TR>')
              document.writeln ('<TD style=width:100%;  onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor="";>')
                  if(menuitems[x][xx].match("popup:"))
                    {
                         document.writeln ('<a  href=# onclick=\'window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;\' class=m>');                    
                    }
                    else
                    {
                         document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m'+(newWin.indexOf('|'+menuitems[x][xx+1]+'|')!=-1?' target=blank':'')+'>');              
                    }
                 
              document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              document.writeln ('</TD></TR></TABLE>');
               }
              else {
              document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m >');
              document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              }
            xx = xx +1
             if ((xx) > intmaxsplit - 2) { document.writeln('</td><td valign=top>')
              var intmaxsplit = 500
             }  
            }
         document.writeln ('<br>');
          document.writeln ('</td></tr></table></div>');  
           }
      }
generate_layers();

if (browser_type == "Netscape" && (browser_version >= 4) && navigator.platform.indexOf("Mac") >= 0) { var steps = steps - 20 }

function getAnchorPosition(anchorname) {
    var useWindow = false;
    var coordinates = new Object();
    var x=0;
    var y=0;
    var w_gebi = false;
    var w_css = false;
    var w_layers = false;
    if (document.getElementById) { w_gebi = true; }
    else if (document.all) { w_css = true; }
    else if (document.layers) { w_layers = true; }

     if (w_gebi && document.all) {
         x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
         y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
         }
    else if (w_gebi) {
         var o = document.getElementById(anchorname);
         x = o.offsetLeft;
         y = o.offsetTop;
         }
     else if (w_css) {
         x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
         y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
         }
    else if (w_layers) {
         var found=0;
         for (var i=0; i<document.anchors.length; i++) {
              if (document.anchors[i].name == anchorname) {
                   found=1;
                   break;
                   }
              }
         if (found == 0) {
              coordinates.x=0; coordinates.y=0; return coordinates;
              }
         x = document.anchors[i].x;
         y = document.anchors[i].y;
         }
    else {
         coordinates.x=0; coordinates.y=0; return coordinates;
         }
    coordinates.x = x;
    coordinates.y = y;
    return coordinates;
    }




function AnchorPosition_getPageOffsetLeft (el) {
    var ol = el.offsetLeft;
    while ((el = el.offsetParent) != null) {
          ol += el.offsetLeft;
          }
    return ol;
    }
function AnchorPosition_getWindowOffsetLeft (el) {
    var scrollamount = document.body.scrollLeft;
    return AnchorPosition_getPageOffsetLeft(el)-scrollamount;
    }    
function AnchorPosition_getPageOffsetTop (el) {
    var ot = el.offsetTop;
    while((el = el.offsetParent) != null) {
          ot += el.offsetTop;
          }
    return ot;
    }

function AnchorPosition_getWindowOffsetTop (el) {
    var scrollamount = document.body.scrollTop;
    return AnchorPosition_getPageOffsetTop(el)-scrollamount;
    }

function removeall() {
    for(i = 1; i <= menuitems.length; i++) { remove(i);  }
}

function show(object) {

    var c = getAnchorPosition(object.replace(/submenu/, "menu"));
    if (c.x < 1) { c.x = 31; }
    if (c.y < 1) { c.y = 155; }
   
     
   if (document.getElementById && document.getElementById(object) != null) {
       document.getElementById(object).style.top=c.y + steps+"px";
       document.getElementById(object).style.left= c.x - rsteps+"px";
       node = document.getElementById(object).style.visibility='visible';
       document.body.onclick= removeall;
   }
   else if (document.layers && document.layers[object] != null) {
          document.layers[object].visibility = 'visible';
          document.layers[object].top = c.y + steps;
          document.layers[object].left = c.x - rsteps;
          document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN);
          document.onmousedown = removeall;
          }
   else if (document.all)
       {
       document.all[object].style.visibility = 'visible';
       document.all[object].style.pixelTop = c.y + steps;
         document.all[object].style.pixelLeft = c.x - rsteps;
         document.body.onclick= removeall;
         }

    var id = object.replace(/submenu/, "");
    for(i = 1; i <= menuitems.length; i++)
    {
         if  (i != id) {
         remove(i);
         }
    }
    var c = null
}


function removeall() {
    for(i = 1; i <= menuitems.length; i++) { remove(i);  }
}



function remove(id) {
   
     if (document.getElementById && document.getElementById('submenu'+id) != null) {
       node = document.getElementById('submenu'+id).style.visibility='hidden';
   }
   else if (document.layers && document.layers['submenu'+id] != null) {
          document.layers['submenu'+id].visibility = 'hidden';
          }
   else if (document.all)
       {
       document.all['submenu'+id].style.visibility = 'hidden';
         }
}

//--></script>

                   <body bgcolor="#F4F8E1">

                   <table width="760" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#111111">
                        <tr>
<span align="center">
                     <td>
         <table border="1" cellpadding="0" cellspacing="0"
          style="border-collapse: collapse" bordercolor="#000000" width="760" bgcolor="#89AE79">
              <tr><td>
                   <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                        <tr>
<span align="center">
                     <td bordercolor="#89AE79">
         <table border="1" cellpadding="0" cellspacing="0"
          style="border-collapse: collapse" bordercolor="#89AE79" width="760">
              <tr><td>
                   <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                        <tr>
                        <td width="50%">
                             <img border="0" src="ima\logo1.jpg" width="171" height="73">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                             <font face="Arial" size="2">&nbsp;<b><span align="center"><span ID="linktext0"><a href= "staffmainpage.asp?"><font color="#000000">Home</font></a></span></span></b></font></td>
                        <td width="50%">
<span align="center">
                             <p align="center">
                             <b><font size="2" face="Arial" color="#444444">Welcome
                        to the CTVO<br>
                       </font>
                       <font face="Arial" color="#444444" style="font-size: 9pt">
                       CT's&nbsp; Virtual Office©</font></b></span></td>
                        </tr>
                   </table>
              </td></tr>
         </table>
    </td>

</span>

                   </tr>
                   </table>
              </td></tr>
         </table>
    </td>

</span>

                   </tr>
                   </table>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760" id="AutoNumber1" height="23">
<tr>
<td height="23">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760" id="AutoNumber1" height="22">
    <tr>
<td width="132" height="22"><b><font size="2" color="#444444">&nbsp; <a onMouseOver="show('submenu1')" class="m" id="menu1" name="menu1">
<font size="2">Message Center</font></a></font></b></td>
<td width="124" height="22"><b><a onMouseOver="show('submenu2')" class="m" id="menu2" name="menu2"><font size="2" color="#444444">Employee Center</font></a></b></td>
<td width="116" height="22"><b><a onMouseOver="show('submenu3')" class="m" id="menu3" name="menu3"><font size="2" color="#444444">Realtor Tools</font></a></b></td>
<td width="87" height="22"><b><a onMouseOver="show('submenu4')" class="m" id="menu4" name="menu4"><font size="2" color="#444444">Listings</font></a></b></td>
<td width="166" height="22"><b><a onMouseOver="show('submenu5')" class="m" id="menu5" name="menu5"><font size="2" color="#444444">Manage
Transactions</font></a></b></td>
<td width="125" height="22"><b><a onMouseOver="show('submenu6')" class="m" id="menu6" name="menu6"><font size="2" color="#444444">Lead Center</font></a></b></td>
    </tr>
    </table>
</td>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse:collapse;color=#444444;font-size=12;font-family=Arial;font-weight=bold"
width="760" bgcolor="#BED9C4" bordercolor="#BED9C4" height="1">
    <tr>
<span align="center">
<span ID="linktext">
    <td width="630" height="16" align="left" bgcolor="#89AE79">
    <p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <font color="#000000">&nbsp;&nbsp;&nbsp; </font></td>
    </span>

</span>

    </tr>
</table>
Avatar of Plucka
Plucka
Flag of Australia image

Hi eteran,

You just need to put your <a href around the <tr or <td not just around the text.

Regards
Plucka
Avatar of eteran

ASKER

I did that and still not working.
Avatar of Zvonko
Search this lines and take the new version:

             document.writeln ('<TABLE width=114 border=0 cellspacing=0 cellpadding=0><TR>')
             document.writeln ('<TD style=width:100%;  onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; ')
                 if(menuitems[x][xx].match("popup:"))
                   {
                        document.writeln (' onclick=\'window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;\' class=m ');                    
                   }
                   else
                   {
                        document.writeln (' onclick=\'window.location= "' + menuitems[x][xx] + '"\' ');              
                    }
               
             document.writeln ('>' + menuitems[x][xx+1] + '');
             document.writeln ('</TD></TR></TABLE>');

Avatar of eteran

ASKER

Zvonko,
I do not see what I replace
Never mind.

Take the complette page:
<style type="text/css"> <!--
.submenuStyle {
   position: absolute;
   visibility: hidden;
}
.menuStyle {
    visibility: visable;
}
.m
{
   FONT-SIZE: 12;
   COLOR: #444444;
   FONT-FAMILY: Arial;
   font style: BOLD;
   TEXT-DECORATION: none
}
//--></style>

<script language="JavaScript"><!--

  // How many pixels to adjust down:
 var steps = 20;
 // How many total items untill the table is splits:
 var split = 10;
 // How many pixels to adjust left:
 var rsteps = 6;
 
 
 // Try these for vertical menus:
 // var steps = -6;
 // How many total items untill the table is splits:
 // var split = 200     ;
 // How many pixels to adjust left:
 // var rsteps = -74;

// Create new main array.
var menuitems =      [["popup:email_cdo.asp", "Add Message", "StaffEmail.asp", "View Email","faxlogin.asp","Fax Center"],
                               ["staffemployeebook.asp", "Employee Phone Book","Staffeditprofile.asp", "Edit Profile"],
                               ["HTTP://SEF.MLXCHANGE.COM", "MLS", "HTTP://MIAMIRE.COM", "Board of Realtors", "StaffFinancial.asp", "Financial Calculator", "staffzipform.asp","Create Contract"],
                             ["Staffviewofficelisting.asp", "Office Listings","staffaddofficelisting.asp", "Add Office Listing"],
                   ["staffaddtransaction.asp","Add Transaction","staffviewactive.asp?ID=Active", "Active Pipeline", "staffviewactive.asp?ID=Closed", "Closed Pipeline", "staffviewactive.asp?ID=Dropped", "Dropped Pipeline", "StaffTransactionreport.asp", "Report"],
                        ["popup:staffaddlead.html", "Add Lead","staffleadviewer.asp", "Office Leads", "StaffMyleadviewer.asp","My Leads", "popup:Staffaddmylead.html","Add My Lead"]]

//LIST ITEMS YOU WANT TO OPEN UP IN A NEW WINDOW HERE
var newWin=new Array("HTTP://SEF.MLXCHANGE.COM","MLS","HTTP://MIAMIRE.COM", "Board of Realtors");

//Generate Span Layers
function generate_layers()
{
  newWin="|"+newWin.join("|")+"|";
 var x=0;
  browser_type = navigator.appName;

  for (x=0; x< menuitems.length; x++)
       {
          if (browser_type ==  "Microsoft Internet Explorer") {
          document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle style="z-index:1;">');
         }
         else {
         document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle>');
         }          
         document.writeln ('<table border=1 bgcolor=#ffffff bordercolor=#89AE79 cellspacing=0 cellpadding=5><tr><td valign=top>')
          var intmaxsplit = 50
              if ((menuitems[x].length/5) > (split/2)) {
               var intmaxsplit = (menuitems[x].length/2)
               if  (((intmaxsplit) % 2) == 0.5) {var intmaxsplit = intmaxsplit + 1;}
               }

             for (xx=0; xx< menuitems[x].length; xx++)
            {
             
                  if (browser_type ==  "Microsoft Internet Explorer") {
             document.writeln ('<TABLE width=114 border=0 cellspacing=0 cellpadding=0><TR>')
             document.writeln ('<TD style=width:100%;  onMouseover=\'this.style.backgroundColor="#89AE79";\' onMouseout=\'this.style.backgroundColor="";\' class=m ')
                 if(menuitems[x][xx].match("popup:"))
                   {
                        document.writeln (' onclick=\'window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;\' ');                    
                   }
                   else
                   {
                        document.writeln (' onclick=\'window.location= "' + menuitems[x][xx] + '"\' ');              
                    }
               
             document.writeln ('>' + menuitems[x][xx+1] + '');
             document.writeln ('</TD></TR></TABLE>');

               }
              else {
              document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m >');
              document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              }
            xx = xx +1
             if ((xx) > intmaxsplit - 2) { document.writeln('</td><td valign=top>')
              var intmaxsplit = 500
             }  
            }
         document.writeln ('<br>');
          document.writeln ('</td></tr></table></div>');  
           }
      }
generate_layers();

if (browser_type == "Netscape" && (browser_version >= 4) && navigator.platform.indexOf("Mac") >= 0) { var steps = steps - 20 }

function getAnchorPosition(anchorname) {
    var useWindow = false;
    var coordinates = new Object();
    var x=0;
    var y=0;
    var w_gebi = false;
    var w_css = false;
    var w_layers = false;
    if (document.getElementById) { w_gebi = true; }
    else if (document.all) { w_css = true; }
    else if (document.layers) { w_layers = true; }

     if (w_gebi && document.all) {
         x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
         y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
         }
    else if (w_gebi) {
         var o = document.getElementById(anchorname);
         x = o.offsetLeft;
         y = o.offsetTop;
         }
     else if (w_css) {
         x = AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
         y = AnchorPosition_getPageOffsetTop(document.all[anchorname]);
         }
    else if (w_layers) {
         var found=0;
         for (var i=0; i<document.anchors.length; i++) {
              if (document.anchors[i].name == anchorname) {
                   found=1;
                   break;
                   }
              }
         if (found == 0) {
              coordinates.x=0; coordinates.y=0; return coordinates;
              }
         x = document.anchors[i].x;
         y = document.anchors[i].y;
         }
    else {
         coordinates.x=0; coordinates.y=0; return coordinates;
         }
    coordinates.x = x;
    coordinates.y = y;
    return coordinates;
    }




function AnchorPosition_getPageOffsetLeft (el) {
    var ol = el.offsetLeft;
    while ((el = el.offsetParent) != null) {
          ol += el.offsetLeft;
          }
    return ol;
    }
function AnchorPosition_getWindowOffsetLeft (el) {
    var scrollamount = document.body.scrollLeft;
    return AnchorPosition_getPageOffsetLeft(el)-scrollamount;
    }    
function AnchorPosition_getPageOffsetTop (el) {
    var ot = el.offsetTop;
    while((el = el.offsetParent) != null) {
          ot += el.offsetTop;
          }
    return ot;
    }

function AnchorPosition_getWindowOffsetTop (el) {
    var scrollamount = document.body.scrollTop;
    return AnchorPosition_getPageOffsetTop(el)-scrollamount;
    }

function removeall() {
    for(i = 1; i <= menuitems.length; i++) { remove(i);  }
}

function show(object) {

    var c = getAnchorPosition(object.replace(/submenu/, "menu"));
    if (c.x < 1) { c.x = 31; }
    if (c.y < 1) { c.y = 155; }
   
     
   if (document.getElementById && document.getElementById(object) != null) {
       document.getElementById(object).style.top=c.y + steps+"px";
       document.getElementById(object).style.left= c.x - rsteps+"px";
       node = document.getElementById(object).style.visibility='visible';
       document.body.onclick= removeall;
   }
   else if (document.layers && document.layers[object] != null) {
          document.layers[object].visibility = 'visible';
          document.layers[object].top = c.y + steps;
          document.layers[object].left = c.x - rsteps;
          document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN);
          document.onmousedown = removeall;
          }
   else if (document.all)
       {
       document.all[object].style.visibility = 'visible';
       document.all[object].style.pixelTop = c.y + steps;
         document.all[object].style.pixelLeft = c.x - rsteps;
         document.body.onclick= removeall;
         }

    var id = object.replace(/submenu/, "");
    for(i = 1; i <= menuitems.length; i++)
    {
         if  (i != id) {
         remove(i);
         }
    }
    var c = null
}


function removeall() {
    for(i = 1; i <= menuitems.length; i++) { remove(i);  }
}



function remove(id) {
   
     if (document.getElementById && document.getElementById('submenu'+id) != null) {
       node = document.getElementById('submenu'+id).style.visibility='hidden';
   }
   else if (document.layers && document.layers['submenu'+id] != null) {
          document.layers['submenu'+id].visibility = 'hidden';
          }
   else if (document.all)
       {
       document.all['submenu'+id].style.visibility = 'hidden';
         }
}

//--></script>

                   <body bgcolor="#F4F8E1">

                   <table width="760" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border-collapse: collapse" bordercolor="#111111">
                        <tr>
<span align="center">
                     <td>
         <table border="1" cellpadding="0" cellspacing="0"
          style="border-collapse: collapse" bordercolor="#000000" width="760" bgcolor="#89AE79">
              <tr><td>
                   <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                        <tr>
<span align="center">
                     <td bordercolor="#89AE79">
         <table border="1" cellpadding="0" cellspacing="0"
          style="border-collapse: collapse" bordercolor="#89AE79" width="760">
              <tr><td>
                   <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                        <tr>
                        <td width="50%">
                             <img border="0" src="ima\logo1.jpg" width="171" height="73">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                             <font face="Arial" size="2">&nbsp;<b><span align="center"><span ID="linktext0"><a href="staffmainpage.asp?"><font color="#000000">Home</font></a></span></span></b></font></td>
                        <td width="50%">
<span align="center">
                             <p align="center">
                             <b><font size="2" face="Arial" color="#444444">Welcome
                        to the CTVO<br>
                       </font>
                       <font face="Arial" color="#444444" style="font-size: 9pt">
                       CT's&nbsp; Virtual Office©</font></b></span></td>
                        </tr>
                   </table>
              </td></tr>
         </table>
    </td>

</span>

                   </tr>
                   </table>
              </td></tr>
         </table>
    </td>

</span>

                   </tr>
                   </table>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760" id="AutoNumber1" height="23">
<tr>
<td height="23">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760" id="AutoNumber1" height="22">
    <tr>
<td width="132" height="22"><b><font size="2" color="#444444">&nbsp; <a onMouseOver="show('submenu1')" class="m" id="menu1" name="menu1">
<font size="2">Message Center</font></a></font></b></td>
<td width="124" height="22"><b><a onMouseOver="show('submenu2')" class="m" id="menu2" name="menu2"><font size="2" color="#444444">Employee Center</font></a></b></td>
<td width="116" height="22"><b><a onMouseOver="show('submenu3')" class="m" id="menu3" name="menu3"><font size="2" color="#444444">Realtor Tools</font></a></b></td>
<td width="87" height="22"><b><a onMouseOver="show('submenu4')" class="m" id="menu4" name="menu4"><font size="2" color="#444444">Listings</font></a></b></td>
<td width="166" height="22"><b><a onMouseOver="show('submenu5')" class="m" id="menu5" name="menu5"><font size="2" color="#444444">Manage
Transactions</font></a></b></td>
<td width="125" height="22"><b><a onMouseOver="show('submenu6')" class="m" id="menu6" name="menu6"><font size="2" color="#444444">Lead Center</font></a></b></td>
    </tr>
    </table>
</td>
</tr>
</table>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse:collapse;color=#444444;font-size=12;font-family=Arial;font-weight=bold"
width="760" bgcolor="#BED9C4" bordercolor="#BED9C4" height="1">
    <tr>
<span align="center">
<span ID="linktext">
    <td width="630" height="16" align="left" bgcolor="#89AE79">
    <p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <font color="#000000">&nbsp;&nbsp;&nbsp; </font></td>
    </span>

</span>

    </tr>
</table>



Avatar of eteran

ASKER

the pop ups are not working
Avatar of eteran

ASKER

that script that you posted is not wokring correctly can anyone help
Avatar of sajuks
sajuks

eteran ,
 the code that Zvonko provided is perfect, am able to get the popups in my browser.Did you cut and paste the page properly. Would be better if you posted your new page again so that we can see if there are any other errors.
Avatar of eteran

ASKER

 
this links do not pop up
["HTTP://SEF.MLXCHANGE.COM", "MLS", "HTTP://MIAMIRE.COM", "Board of Realtors", "StaffFinancial.asp",
Hi eteran...

I've changed this function a little so that if performs as you want...

//Generate Span Layers
function generate_layers()
{
  newWin="|"+newWin.join("|")+"|";
 var x=0;
  browser_type = navigator.appName;

  for (x=0; x< menuitems.length; x++)
       {
          if (browser_type ==  "Microsoft Internet Explorer") {
          document.writeln ('<div   id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle  style="z-index:1;">');
         }
         else {
         document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle>peter');
         }          
         document.writeln ('<table  onMouseOut=Check() border=1 bgcolor=#ffffff bordercolor=#89AE79 cellspacing=0 cellpadding=5><tr><td valign=top>')
          var intmaxsplit = 50
              if ((menuitems[x].length/5) > (split/2)) {
               var intmaxsplit = (menuitems[x].length/2)
               if  (((intmaxsplit) % 2) == 0.5) {var intmaxsplit = intmaxsplit + 1;}
               }

             for (xx=0; xx< menuitems[x].length; xx++)
            {
             
                  if (browser_type ==  "Microsoft Internet Explorer") {
              document.writeln ('<TABLE  width=114 border=0 cellspacing=0 cellpadding=0 onMouseOver=Check()><TR>')
              //document.writeln ('<TD style=width:100%;  onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor="";>')
                  if(menuitems[x][xx].match("popup:"))
                    {
                                    document.writeln ('<TD style=width:100%; style="cursor: hand"; onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; onclick=window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;')
                        document.writeln('<span class=m>')
                         //document.writeln ('<a  href=# onclick=\'window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;\' class=m>');                    
                    }
                    else
                    {
                                    document.writeln ('<TD style=width:100%; style="cursor: hand"; onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; onclick=window.location.href="'+menuitems[x][xx]+'";')
                                    document.writeln('<span class=m>')
                         //document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m'+(newWin.indexOf('|'+menuitems[x][xx+1]+'|')!=-1?' target=blank':'')+'>');              
                    }
                 
              //document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              document.writeln(menuitems[x][xx+1] + '</span><br>');
              document.writeln ('</TD></TR></TABLE>');
               }
              else {
              document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m >');
              document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              }
            xx = xx +1
             if ((xx) > intmaxsplit - 2) { document.writeln('</td><td valign=top>')
              var intmaxsplit = 500
             }  
            }
         document.writeln ('<br>');
          document.writeln ('</td></tr></table></div>');  
           }
      }

The following additions do the bit where it closes the menu once you move away from them...

function Check()
      {
            if(job)
                  {
                        clearTimeout(job)
                        job = 0
                  }
            
            job = setTimeout("removeall()",1000)
      }

function SetTime()
      {
            job = setTimeout("removeall()",1000)
      }

you will also need to add this to the <body> tag.

onLoad="SetTime()"

I've tested and it seems to work fine. Where the 1000 is this is 1 second.
Avatar of eteran

ASKER

?????????????????????????????/
I have tried to paste the code in the menu asnd it is not working
Ok, I've put it online so you can see it working and then put the bits that I've changed in a <textarea> so you can copy it.

You need to replace the whole of the function generate_layers() with the one I supplied.

http://www.internection.co.uk/Source/eteran.htm

Cheers

McFly
Avatar of eteran

ASKER

OKay, I got it. can I make it disapear faster. and also there are links located that need to target in a new window
var newWin=new Array("HTTP://SEF.MLXCHANGE.COM","MLS","HTTP://MIAMIRE.COM", "Board of Realtors");
to change the quickness change the...

job = setTimeout("removeall()",1000)   <---- 1000 = 1 second

Ok, sorted the new window bit - I changed it a tiny bit coz I don't understand this bit - class=m'+(newWin.indexOf('|'+menuitems[x][xx+1]+'|')!=-1?' target=blank':'')+'>'); - but my modifications do work.

Ignore (remove - not needed now) this bit....

var newWin=new Array("HTTP://SEF.MLXCHANGE.COM","MLS","HTTP://MIAMIRE.COM", "Board of Realtors");


In this bit...

var menuitems =      [["popup:email_cdo.asp", "Add Message", "StaffEmail.asp", "View Email","faxlogin.asp","Fax Center"],
                               ["staffemployeebook.asp", "Employee Phone Book","Staffeditprofile.asp", "Edit Profile"],
                               ["newwin:HTTP://SEF.MLXCHANGE.COM", "MLS", "newwin:HTTP://MIAMIRE.COM", "Board of Realtors", "StaffFinancial.asp", "Financial Calculator", "staffzipform.asp","Create Contract"],
                             ["Staffviewofficelisting.asp", "Office Listings","staffaddofficelisting.asp", "Add Office Listing"],
                   ["staffaddtransaction.asp","Add Transaction","staffviewactive.asp?ID=Active", "Active Pipeline", "staffviewactive.asp?ID=Closed", "Closed Pipeline", "staffviewactive.asp?ID=Dropped", "Dropped Pipeline", "StaffTransactionreport.asp", "Report"],
                        ["popup:staffaddlead.html", "Add Lead","staffleadviewer.asp", "Office Leads", "StaffMyleadviewer.asp", "My Leads", "popup:Staffaddmylead.html","Add My Lead"]]


...there is popup: - which is the popup windows, and then just normal pages, say staffemployeebook.asp for example.

I created a new one called newwin: - you can see in the menuitems I have prefixed HTTP://SEF.MLXCHANGE.COM with the new one I created - this is tested and works - hope thats ok.

I have posted the updates online (so you can test it if you like) but they are here below as well.....


var menuitems =      [["popup:email_cdo.asp", "Add Message", "StaffEmail.asp", "View Email","faxlogin.asp","Fax Center"],
                               ["staffemployeebook.asp", "Employee Phone Book","Staffeditprofile.asp", "Edit Profile"],
                               ["newwin:HTTP://SEF.MLXCHANGE.COM", "MLS", "newwin:HTTP://MIAMIRE.COM", "Board of Realtors", "StaffFinancial.asp", "Financial Calculator", "staffzipform.asp","Create Contract"],
                             ["Staffviewofficelisting.asp", "Office Listings","staffaddofficelisting.asp", "Add Office Listing"],
                   ["staffaddtransaction.asp","Add Transaction","staffviewactive.asp?ID=Active", "Active Pipeline", "staffviewactive.asp?ID=Closed", "Closed Pipeline", "staffviewactive.asp?ID=Dropped", "Dropped Pipeline", "StaffTransactionreport.asp", "Report"],
                        ["popup:staffaddlead.html", "Add Lead","staffleadviewer.asp", "Office Leads", "StaffMyleadviewer.asp", "My Leads", "popup:Staffaddmylead.html","Add My Lead"]]



function generate_layers()
{
  newWin="|"+newWin.join("|")+"|";
 var x=0;
  browser_type = navigator.appName;

  for (x=0; x< menuitems.length; x++)
       {
          if (browser_type ==  "Microsoft Internet Explorer") {
          document.writeln ('<div   id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle  style="z-index:1;">');
         }
         else {
         document.writeln ('<div id=submenu'+ (x+1)  +' name=submenu'+ (x+1)  +' class=submenuStyle>peter');
         }          
         document.writeln ('<table  onMouseOut=Check() border=1 bgcolor=#ffffff bordercolor=#89AE79 cellspacing=0 cellpadding=5><tr><td valign=top>')
          var intmaxsplit = 50
              if ((menuitems[x].length/5) > (split/2)) {
               var intmaxsplit = (menuitems[x].length/2)
               if  (((intmaxsplit) % 2) == 0.5) {var intmaxsplit = intmaxsplit + 1;}
               }

             for (xx=0; xx< menuitems[x].length; xx++)
            {
             
                  if (browser_type ==  "Microsoft Internet Explorer") {
              document.writeln ('<TABLE  width=114 border=0 cellspacing=0 cellpadding=0 onMouseOver=Check()><TR>')
              //document.writeln ('<TD style=width:100%;  onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor="";>')
                  if(menuitems[x][xx].match("popup:"))
                    {
                                    document.writeln ('<TD style=width:100%; style="cursor: hand"; onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; onclick=window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;')
                        document.writeln('<span class=m>')
                         //document.writeln ('<a  href=# onclick=\'window.open("'+menuitems[x][xx].split("popup:")[1]+'","","width=530,height=460");return false;\' class=m>');                    
                    }
                   else if (menuitems[x][xx].match("newwin:"))
                              {
                                    document.writeln ('<TD style=width:100%; style="cursor: hand"; onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; onclick=window.open("'+menuitems[x][xx].split("newwin:")[1]+'","","");return false;')
                        document.writeln('<span class=m>')
                              }
                    else
                    {
                                    document.writeln ('<TD style=width:100%; style="cursor: hand"; onMouseover=this.style.backgroundColor="#89AE79"; onMouseout=this.style.backgroundColor=""; onclick=window.location.href="'+menuitems[x][xx]+'";')
                                    document.writeln('<span class=m>')
                         //document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m'+(newWin.indexOf('|'+menuitems[x][xx+1]+'|')!=-1?' target=blank':'')+'>');              
                    }
                 
              //document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              document.writeln(menuitems[x][xx+1] + '</span><br>');
              document.writeln ('</TD></TR></TABLE>');
               }
              else {
              document.writeln ('<a href = ' + menuitems[x][xx] + ' class=m >');
              document.writeln ('' + menuitems[x][xx+1] + '</a><br>');
              }
            xx = xx +1
             if ((xx) > intmaxsplit - 2) { document.writeln('</td><td valign=top>')
              var intmaxsplit = 500
             }  
            }
         document.writeln ('<br>');
          document.writeln ('</td></tr></table></div>');  
           }
      }







Avatar of eteran

ASKER

I am getting an error??? I cut and paste the new code and the drop downs are not working.
What is the error?
Avatar of eteran

ASKER

No pop ups
Avatar of eteran

ASKER

on the mouse over. Anyway of pasting the working code so I can Compare the diffrence/.
ASKER CERTIFIED SOLUTION
Avatar of Lord_McFly
Lord_McFly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial