日期:2014-05-16  浏览次数:20326 次

动态菜单问题
以下菜单程序把DrawMouseMenu(MenuValue1,MenuValue2,MenuValue5);放在script中,按钮中只用"return ShowMouseMenu();"就可以弹出菜单,但我把DrawMouseMenu(MenuValue1,MenuValue2,MenuValue5);放到按钮的onclick就不行,我想实现点击不同按钮出来不同的菜单效果。
<input type="button" value="Oper2" Author="CaoZuo" onclick="javascript:DrawMouseMenu(MenuValue1,MenuValue2,MenuValue5);return ShowMouseMenu();">

另外,input 按钮必须放在script中,不然报MenuValue1等未定义,不知道为什么?

HTML code

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>邮件菜单</TITLE>
<link rel="stylesheet"                   href="/zygl/css/style.css" type="text/css">
<script language="javascript">
    
TableColor = "rgb(0,0,200)";
TableColor = "rgb(14,117,124)";

function DrawMouseMenu()
{
    DivH = 2;
    oSelection = document.selection;
    var HrStr;
    HrStr  =  "<tr>";
    HrStr +=  " <td align=\"center\" valign=\"middle\" height=\"2\">";
    HrStr +=  "  <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100\" height=\"2\">";
    HrStr +=  "   <tr>";
    HrStr +=  "    <td height=\"1\" bgcolor=\"buttonshadow\"><\/td>";
    HrStr +=  "   <\/tr>";
    HrStr +=  "   <tr>";
    HrStr +=  "    <td height=\"1\" bgcolor=\"buttonhighlight\"><\/td>";
    HrStr +=  "   <\/tr>";
    HrStr +=  "  <\/TABLE>";
    HrStr +=  " <\/td>";
    HrStr +=  "<\/tr>";
    var MenuStr1;
    MenuStr1  = "<tr>";
    MenuStr1 +="<td align=\"center\" valign=\"middle\" height=\"20\">";
    MenuStr1 +=" <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100\">";
    MenuStr1 +="  <tr>";
    MenuStr1 +="   <td valign=\"middle\" height=\"16\" class=\"Mout\" onMouseOver=\"this.className='Mover';\" onMouseOut=\"this.className='Mout';\" onclick=\"";
    var MenuStr2 = "<\/td><\/tr><\/TABLE><\/td><\/tr>";

    var MenuStr = "";
 
    for (i = 0; i < arguments.length; i++)
    {
        MenuStr += MenuStr1 + arguments[i] + MenuStr2;
        DivH += 20;
    }
  
    var DivStr1;
    DivStr1  = "<DIV id=\"MouseMenu\" class=\"div1\" style=\"position:absolute; left:0px; top:0px; width=115;height=" + DivH + "; z-index:1; visibility:hidden;\">";
    DivStr1 += " <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"div2\">";
    DivStr1 += "  <tr>";
    DivStr1 += "   <td bgcolor=\"" + TableColor + "\" width=\"15\" valign=\"center\" align=\"center\" style=\"color:white;\" bgcolor=\"buttonface\">";
    DivStr1 += "    <b>操<br>作</b>";
    DivStr1 += "   <\/td>";
    DivStr1 += "   <td bgcolor=\"buttonface\">";
    DivStr1 += "    <TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
    var DivStr2;
    DivStr2  = "    <\/TABLE>";
    DivStr2 += "   <\/td>";
    DivStr2 += "  <\/tr>";
    DivStr2 += " <\/TABLE>";
    DivStr2 +=