ASP.NET li / ul标记'菜单'不起作用

时间:2011-06-28 23:08:17

标签: asp.net vb.net menu html-lists

我的aspx页面(jsddm)上有一个“菜单栏”。当鼠标悬停在顶级菜单项上时,项目出现,当鼠标离开时,项目消失。当我在我的虚拟机上点击F5时它运行良好(我的vm运行Win 2003服务器并使用IE 8.0.6001.18702,也运行VS2008)。

然而,当我发布它(在同一个虚拟机上的IIS中托管)并尝试从我的常规机器(使用IE 8.0.7600.16385的Win 7)查看它时,小错误的人将无法正常工作。

任何帮助,为什么这将是非常感谢!谢谢!

这是代码,所以你可以看到我在说什么:

#jsddm
{   margin: 0;
    padding: 0;}

#jsddm li
{   float: left;
    list-style: none;
    font: 12px Tahoma, Arial;}

#jsddm li a
{   display: block;
    background: #20548E;
    padding: 5px 12px;
    text-decoration: none;
    border-right: 1px solid white;
    width: 70px;
    color: #EAFFED;
    white-space: nowrap;}

#jsddm li a:hover
{   background: #1A4473;}

    #jsddm li ul
    {   margin: 0;
        padding: 0;
        position: absolute;
        visibility: hidden;
        border-top: 1px solid white;}

    #jsddm li ul li
    {   float: none;
        display: inline;}

    #jsddm li ul li a
    {   width: auto;
        background: #9F1B1B;}

    #jsddm li ul li a:hover
    {   background: #7F1616;}

    #GetPolicy
    {   text-align: left;}

    .style1
    {
        width: 100%;
    }
    .style2
    {
        width: 282px;
    }

    .style3
    {
        height: 100px;
    }
    .style4
    {
        height: 100px;
        width: 303px;
    }
    .style5
    {
        width: 303px;
    }

    #ltrVariables
    {
        width: 553px;
        height: 329px;
    }

    .style6
    {
        width: 358px;
    }

    .style7
    {
        width: 228px;
    }

    .ModalPopupBG
    {
    background-color: #666699;
    filter: alpha(opacity=50);
    opacity: 0.7;
    }

    .HellowWorldPopup
    {
    min-width:200px;
    min-height:100px;
    background:white;
    border-color:Silver;
    border-style:ridge;
    border-width:medium;

    }
    .HeaderStyle
    {
     color:Black;
     background-color:Black;
     border-style:solid;
    }
    .PopupHeader
    {
    color:Black;
    background-color:white;
    }
    .style8
    {
        height: 20px;
    }
    </style>



</head>
<body leftmargin="0" topmargin="0"
background="Images/tile-grey-stripe.jpg">
<form id="Form1" defaultbutton="GetPolicy" runat="server">



    <table width="1000" height="99" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="35" background="../Images/a_ag01.jpg"></td>
            <td width="524"><img src="Images/a_ag1.jpg" alt="" width="524" height="99" border="0" align="top" /></td>
            <td width="389">
                <table border="0" cellspacing="0" cellpadding="0" width="389">
                    <tr>
                        <td width="218"><img id="imgHeader" src="Images/text_title_producer1.jpg" style="height:99px;width:218px;border-width:0px;" /></td>
            <td width="111"><img id="imgHeadr2" src="Images/text_title-TILE.jpg" style="height:99px;width:171px;border-width:0px;" /></td>
                    </tr>
                </table>
            </td>
            <td width="19" align="right"><img src="Images/a_ag4_end.jpg" width="19" height="99" alt="" /></td>
            <td align="right" width="33" background="Images/a_ag5.jpg"></td>
        </tr>
    </table>
    <!--end of the header table -->
    <table height="702" width="1000" border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
            <td width="70" background="Images/b_ag1_lefttile.jpg"> <!-- This is the left wall of the form !-->
                &nbsp;</td>
            <td width="880" valign="top" bgcolor="#FFFFFF">
<!-- Text, controls, buttons, etc goes below this comment. !--> 

<script src="/App_Themes/Default/jquery.js" type="text/javascript"></script>     
<script type="text/javascript">
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function PrintBatchJS()
{if(confirm("Send the ENTIRE batch to printing? (All letters will be removed from system)"))
{var PDFval = document.getElementById('<%= pnlPDF.clientID %>'); 
 if (PDFval == null)
    {if (confirm("Send the entire batch to print and delete them from the database?"))
        {document.cookie="PDF=True";
        window.location = "../Main.aspx";}}}}

function ViewBatchJS()
{var PDFval = document.getElementById('<%= pnlPDF.clientID %>'); 
 if (PDFval == null)
        {document.cookie="PDF=True";
        document.cookie="View=True";
        window.location = "../Main.aspx";}}

function ShowModal()
{$find('ModalPopupExtender1').show()};

function ShowConditionalModal()
{if (document.getElementById("<%= txtPolicyNo.clientID %>").value != "")
    if (Page_IsValid)
    {$find('ModalPopupExtender1').show()}};

function HideModal()
{$find('ModalPopupExtender1').hide();}

function InvalidClientNumber()
{alert("Wrong Number.");  }


function GetLetterForm()
{$find('ModalPopupExtender1').show();
document.ltrVariables.location = document.getElementById("<%= lstNames.clientID %>").value + ".aspx";
document.getElementById("<%= lstNames.clientID %>").disabled = true;
document.getElementById("<%= txtPolicyNo.clientID %>").disabled = true;
document.getElementById("<%= GetPolicy.clientID %>").disabled = true;
$find('ModalPopupExtender1').hide();}

function ResetPanel()
{__doPostBack('pnlMaster', 'PanelReset');}

function GoToBatchOps()
{window.location = "../BatchOperations.aspx";}

function LogOut()
{window.location = "../Login.aspx";}

function jsddm_open()
{  jsddm_canceltimer();
jsddm_close();
ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
{  window.clearTimeout(closetimer);
  closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
$('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;
</script>

<ul id="jsddm">
<li><a href="#">File</a>
    <ul>
        <li><a onclick="__doPostBack('pnlMaster', '');">New Policy</a></li>
        <li><a onclick="PrintBatchJS()">Print Batch</a></li>
        <li><a onclick="ViewBatchJS()">View Batch</a></li>
        <li><a onclick="LogOut()">Log Out</a></li>
    </ul>
</li>
<li><a href="#">Tools</a>
    <ul>
        <li><a onclick="GoToBatchOps()">Batch Operations</a></li>             
    </ul>
</li>
<li><a href="#">Help</a>
    <ul>

        <li><a onclick="LogOut()">Contents</a></li>
    </ul>
</li>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePageMethods="true">
                        </asp:ToolkitScriptManager>
</ul>

1 个答案:

答案 0 :(得分:1)

如果没有看到您的网页正在生成的HTML标记,则很难确定问题所在。 如果JSDDM是Jquery Simple Down Down Menu,则问题可能是VS默认启动网站的虚拟目录

即。设置一个名为“www”的新网站,然后本地URL将默认为“http:// localhost:8123 / www /”。但是,在您发布并使用IIS之后,如果您只是指向已发布的文件夹,那么您的URL可能是“http:// localhost /”。 检查脚本标记,看看你的javascript正在加载什么网址 - 如果从'/ www /'加载,那么网址在IIS网站上无效。

我通常会从VS网站设置中删除虚拟目录,以避免出现这类问题。