我有几个问题,因为我是 ASP.Net 的新手
我有一个 aspx 页面设置如下;
无序列表区域隐藏div隐藏div
无序列表代码:
<div class="literaltext">
<p> We utilize two types of systems for mixing EnerBurn® with your fuel supply to deliver it to your diesel engine,<br /> On-Board systems and Bulk Fueling systems. Click on an item below for more information.</p>
<ul class="ulGreen">
<li><b>On-Board systems - Road Vehicle</b><span style="color:black;"> (See an installation picture<a href="#" onclick="picDisplay('onBoardVehiclepicdisplay')">here</a>)</span> </li>
<li><b>On-Board systems - Marine Vessel</b><span style="color:black;"> (See an installation picture<a href="#" onclick="picDisplay('onBoardVesselpicdisplay')">here</a>)</span> </li>
<li><b>On-Board systems - Fueling Barge</b><span style="color:black;"> (See an installation picture<a href="#" onclick="picDisplay('onBoardBargepicdisplay')">here</a>)</span> </li>
</ul>
</div>
隐藏的 div 是这样设置的;(为简洁起见,仅显示 3 个中的 2 个)
<div id="onBoardVehiclepicdisplay" class="invisible">
<fieldset class="dynamicinjectionpics">
<legend>"Schlumberger On-Board Injection Unit"</legend>
<img Height="300px" Width="400px" alt=""
src="Images/InjectionUnitPictures/SchlumbergerInjectionUnit_FrackTruck.jpg"/>
<img Height="300px" Width="400px" alt=""
src="Images/InjectionUnitPictures/SchlumbergerInjectionUnit_FrackTruck_withEnclosure.jpg"/>
<br /><span id="Image1Text" runat="server">Typical injection unit installation (shown here on a Fracking Unit)</span>
</fieldset>
</div>
<div id="onBoardVesselpicdisplay" class="invisible">
<fieldset class="dynamicinjectionpics">
<legend>"Vessel Fuel Intake Line Mounted Injection System"</legend>
<img Height="300px" Width="400px" alt=""
src="Images/InjectionUnitPictures/SP-600 Injector.jpg"/>
<img Height="300px" Width="400px" alt=""
src="Images/InjectionUnitPictures/MarionInjector Installation.JPG"/>
<br /><span id="Span1" runat="server">Typical injection unit installation for single vessel</span>
</fieldset>
</div>
我想使用 JQuery 将隐藏 div 的类更改为在使用指定的 onclick 函数单击锚标记时可见。这是最好的方法吗?我应该在隐藏的 div 周围有一个更新面板吗?我使用的第一种方法是调用页面重新加载,在其中我为所选标签的图片注入了 innerHTML,它有效,但我假设这是一种业余且不太有效的方法来完成此操作。
此查询不起作用;(无法让 picDisplay 函数识别参数,因此我对其中一个 div id 进行了硬编码以尝试使其工作)
<script>
$(function () {
function picDisplay(divId) {
$("[id='onBoardVehiclepicdisplay']").toggleClass('visible');
}
});
</script>