I have a "menubar" of sorts on my aspx page (jsddm). The items appear when the mouse hovers over the top-level menu item, and disappear when the mouse leaves. When I hit F5 on my virtual machine it works great (my vm is running Win 2003 server and using IE 8.0.6001.18702, also runs VS2008).
However, when I publish it (hosted in IIS on the same VM) and try to view it from my regular machine (Win 7 with IE 8.0.7600.16385) the little buggers won't work properly.
Any help as to why this is would be greatly appreciated! Thanks!
Here's the code so you can see what I'm talking about:
#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 !-->
</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(ddmenuite开发者_如何学Gom) 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>
Without seeing the HTML markup that your page is generating, it's hard to pin point the problem. If JSDDM is Jquery Simple Drop Down Menu, then the problem may be the virtual directory that VS will launch a website in by default
ie. set up a new website called 'www', then the local URL will default to something like 'http://localhost:8123/www/'. However after you have published and you are using IIS, if you are just pointing at the published folder, then your URL may be 'http://localhost/'. Check you Script tag and see what URL your javascript is being loaded from - if it is being loaded from '/www/' then URL would not be valid on the IIS site.
I would usually remove the virtual directory from the VS website settings to avoid these kind of problems.
精彩评论