这是锁定前的效果,点击图标可以操作。锁定之后点击图标这个操作框就不会出来。
js,调试可以进去,控制的好像是克隆前的点击事件,js里面应该怎么写来控制现在页面
的点击事件
<script type="text/javascript">
function GoodsHide(obj) {
document.getElementById(obj.id).style.display = "none";
}
function Part_Show(obj) {
var Partid = obj.id.replace("ImgPart_", "");
document.getElementById("BtnPart_" + Partid).style.display = "block";
document.getElementById("BtnPart_" + Partid).style.zIndex = "999";
}
function GoodsNth(obj) {
document.getElementById(obj.id).style.display = "block";
}
</script>
代码
<td class="center"><%# Eval("RFQStatus").ToString().ToLower()=="false"?"<span style='color:red;'>未报</span>":"<span style='color:#8d8d8d;'>已报</span>" %>
<asp:Panel ID="panOperation" runat="server">
<div class="checkImg"><img alt="" src="/Images/icon/setting_nostock.png" onclick="Part_Show(this)" id="ImgPart_<%# Eval("ID") %>" />
<div class="Goodsbtn" id="BtnPart_<%# Eval("ID") %>" onmouseout="GoodsHide(this)" onmouseover="GoodsNth(this)">
<asp:Button ID="btnNoGoods" CssClass="btnstys" runat="server" Text="无货" />
<asp:Button ID="btnQueGoods" CssClass="btnstys" runat="server" Text="缺货" />
<asp:Button ID="btnReturnSea" CssClass="btnstys" runat="server" Text="退回公海库" />
<asp:Button ID="btnPartIsWrong" CssClass="btnstys" runat="server" Text="型号有误" />
</div>
</div>
</asp:Panel>
</td>
请前辈们解答,谢谢了
id重复了,要通过dom关系获取,要不document.getElementById得到的是原始的table的,被fixed那列的占据了,用jquery使用属性选择器就行。而且你事件有问题,mouseout移动到子元素也会触发的,mouseover就没必要了
<div class="Goodsbtn" id="BtnPart_<%# Eval("ID") %>" onmouseout="GoodsHide(this,event)">
function GoodsHide(obj, e) {
var o = e.toElement || e.relatedTarget;
if ($.contains(obj, o)) return;//移动到子元素推出
$('[id="' + obj.id + '"]').hide()
}
function Part_Show(obj) {
var Partid = obj.id.replace("ImgPart_", "");
$('[id="BtnPart_' + Partid + '"]').show().css('z-index', 999);
}
页面代码
<script type="text/javascript">
$(function () {
$("#tbl_inquiry").toSuperTable({ width: "99%", height: "536", fixedCols: 2 })
});
</script>
<script type="text/javascript">
function GoodsHide(obj) {
document.getElementById(obj.id).style.display = "none";
}
function Part_Show(obj) {
var Partid = obj.id.replace("ImgPart_", "");
document.getElementById("BtnPart_" + Partid).style.display = "block";
document.getElementById("BtnPart_" + Partid).style.zIndex = "999";
}
function GoodsNth(obj) {
document.getElementById(obj.id).style.display = "block";
}
</script>
<table cellpadding="1" cellspacing="1" width="2200" id="tbl_inquiry" class="tbl_inquiry">
<tr style="font-size:12px;">
<th class="head center" style="width:20px;"></th>
<th class="head center" style="width:20px;"><input type="checkbox" id="cbxSelect" name="cbxSelect" /></th>
<th class="head center" style="width:60px;">查价状态</th>
<th class="head center" style="width:60px;">审核状态</th>
<th class="head center" style="width:60px;">采购员</th>
<th class="head center" style="width:130px;">需求型号</th>
<th class="head center" style="width:140px;">需求单号</th>
<th class="head center" style="width:130px;">供应型号</th>
<th class="head center" style="width:130px;">需求品牌</th>
<th class="head center" style="width:130px;">供应品牌</th>
<th class="head center" style="width:80px;">需求数量<asp:Literal runat="server" ID="LitRequestQtyASC" /><asp:Literal runat="server" ID="LitRequestQtyDESC" /></th>
<th class="head center" style="width:70px;">供应数量</th>
<th class="head center" style="width:70px;">客户接受价<br />(人民币)</th>
<th class="head center" style="width:70px;">给客户报价<br />(人民币)</th>
<th class="head center" style="width:70px;">总 价<br />(人民币)</th>
<th class="head center" style="width:70px;">成本价</th>
<th class="head center" style="width:80px;">销售员</th>
<th class="head center" style="width:70px;">国家/地区</th>
<th class="head center" style="width:80px;">封 装</th>
<th class="head center" style="width:70px;">年 份</th>
<th class="head center" style="width:70px;">品 质</th>
<th class="head center" style="width:70px;">货 期</th>
<th class="head center" style="width:100px;">销售备注</th>
<th class="head center" style="width:100px;">采购备注</th>
<th class="head center" style="width:70px;">录入时间<asp:Literal runat="server" ID="LitCreatTimeAsc" /><asp:Literal runat="server" ID="LitCreatTimeDesc" /></th>
<th class="head center" style="width:70px;">接收时间<asp:Literal runat="server" ID="LitTakeTimeAsc" /><asp:Literal runat="server" ID="LitTakeTimeDesc" /></th>
</tr>
<asp:Repeater ID="rpInquiry" runat="server">
<ItemTemplate>
<asp:Literal ID="LitTr" runat="server" />
<td class="center"><%# Eval("OfferUnit").ToString().ToLower()=="true"?"<img alt='加急处理' title='加急处理' src='/Images/icon/flag_red.png'>":""+Eval("RowNumber")+"" %></td>
<td class="center"><asp:CheckBox ID="cbxSelect" runat="server" /></td>
<td class="center"><%# Eval("RFQStatus").ToString().ToLower()=="false"?"<span style='color:red;'>未报</span>":"<span style='color:#8d8d8d;'>已报</span>" %>
<asp:Panel ID="panOperation" runat="server">
<div class="checkImg"><img alt="" src="/Images/icon/setting_nostock.png" onclick="Part_Show(this)" id="ImgPart_<%# Eval("ID") %>" />
<div class="Goodsbtn" id="BtnPart_<%# Eval("ID") %>" onmouseout="GoodsHide(this)" onmouseover="GoodsNth(this)">
<asp:Button ID="btnNoGoods" CssClass="btnstys" runat="server" Text="无货" />
<asp:Button ID="btnQueGoods" CssClass="btnstys" runat="server" Text="缺货" />
<asp:Button ID="btnReturnSea" CssClass="btnstys" runat="server" Text="退回公海库" />
<asp:Button ID="btnPartIsWrong" CssClass="btnstys" runat="server" Text="型号有误" />
</div>
</div>
</asp:Panel>
</td>
<td class="center"><asp:Literal ID="LitAuditStatus" Text='<%# Eval("AuditStatus") %>' runat="server" /></td>
<td class="center"><asp:Literal ID="LitPurchaseName" runat="server" /></td>
<td><asp:Literal ID="LitRequestPartNo" Text='<%# Eval("RequestPartNo") %>' runat="server" /></td>
<td><nobr><asp:Literal ID="LitFRQNo" runat="server" /></nobr></td>
<td><asp:Literal ID="LitOfferPartNo" runat="server" /></td>
<td><asp:Literal ID="LitRequestBrand" Text='<%# Eval("RequestBrand") %>' runat="server" /></td>
<td><asp:Literal ID="LitOfferBrand" runat="server" Text='<%# Eval("OfferBrand") %>' /></td>
<td class="center"><asp:Literal ID="LitRequestQty" Text='<%# Eval("RequestQty") %>' runat="server" /></td>
<td class="center"><asp:Literal ID="LitOfferQty" Text='<%# Eval("OfferQty") %>' runat="server" /></td>
<td class="center"><asp:Literal ID="LitRequestPrice" runat="server" /> </td>
<td class="center"><asp:Literal ID="LitPurchaseOfferPrice" runat="server" /></td>
<td class="center"><asp:Literal ID="LitTotalAmount" runat="server" /></td>
<td class="center"><asp:Literal ID="LitCostPrice" runat="server" /></td>
<td class="center"><asp:Literal ID="LitSales" runat="server" /></td>
<td class="center"><asp:Literal ID="LitCountryRegion" runat="server" /></td>
<td class="center"><%# Eval("RequestPackage") %></td>
<td class="center"><%# Eval("RequestDateCode") %></td>
<td class="center"><%# Eval("ProductQuality") %></td>
<td class="center"><asp:Literal ID="LitLeadTime" runat="server" Text='<%# Eval("LeadTime") %>' /></td>
<td class="center"><%# Eval("RequestDescription") %></td>
<td class="center"><asp:Literal ID="LitPurchaseRemark" runat="server" Text='<%# Eval("OfferDescription") %>' /></td>
<td class="center"><asp:Literal ID="LitInquiryDate" runat="server" />
<div style="display:none;"><asp:Literal ID="LitID" Text='<%# Eval("ID") %>' runat="server" /></div>
</td>
<td class="center"><span class="overflow_date" title="<%# Eval("TakeOverDateTime") %>"><asp:Literal ID="LitTakeOverDateTime" Text='<%# Eval("TakeOverDateTime") %>' runat="server" /></span></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>