DataList里的问题高手帮帮小弟吧!!
<script type="text/javascript">
var prox;
var proy;
var proxc;
var proyc;
function show(id) {/*--打开--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById(id);
o.style.display = "block";
o.style.width = "1px";
o.style.height = "1px";
prox = setInterval(function () { openx(o, 950) }, 10);
}
function openx(o, x) {/*--打开x--*/
var cx = parseInt(o.style.width);
if (cx < x) {
o.style.width = (cx + Math.ceil((x - cx) / 5)) + "px";
}
else {
clearInterval(prox);
proy = setInterval(function () { openy(o, 425) }, 10);
}
}
function openy(o, y) {/*--打开y--*/
var cy = parseInt(o.style.height);
if (cy < y) {
o.style.height = (cy + Math.ceil((y - cy) / 5)) + "px";
}
else {
clearInterval(proy);
}
}
//-----------------------------------------
<asp:DataList ID="DataList1" runat="server" RepeatColumns= "4" >
<ItemTemplate>
<img src='<%# Eval("Pro_Image") %>' height="140" width="187" onclick="show('fd');return false;" alt="" />
</ItemTemplate>
</asp:DataList>
---------------------------------------
<div id="fd" ondblclick="this.style.display='none'"
style="position:absolute;z-index:1 top: 15px; left: 216px; height: 425px; width: 950px; filter:alpha(opacity=100);opacity:1; display:none">
<div>
<asp:DataList ID="DataList3" runat="server" Width="100%" ShowFooter="False"
ShowHeader="False">
<ItemTemplate>
<div>
<div class="dl_left">
<img src='/items/<%# Eval("Pro_Image") %>' onclick='show(<%#Container.ItemIndex%>)' alt="" />
</div>
<div class="dl_right" id="div<%#Container.ItemIndex%>">
<div class="dl_title">
菜品:<%# Eval("Pro_Name") %></div>
<div class="dl_author">
菜系:<%# Eval("Pro_Type")%></div>
<div class="dl_editorcomment">
介绍:<%# Eval("Pro_Detail")%></div>
<div class="dl_unitprice">
价格:<%# Eval("Pro_Price","{0:f2}")%></div>
</div>
</div>
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:DataList>
</div>
</div>
首先 图片是读取出来了 对吧....然后我随便点一张图片 隐藏层就出来了 层里的内容 又要从数据库出来
然后关键是要对应!!不清楚怎么编号
------解决方案-------------------- 同过JS获取层的ID,来获取数据
------解决方案-------------------- 你网上搜索下数据源控件嵌套的使用把,你弄明白这个,你弹出层就会出现数据了!