$.each(res.ZdjList,function(gid,gdata){
gpHtml += '<div class="tab-list">'+
'<ul id="myul">'+
'<a href="#?Mid='+gid+'" class="join_se">'+
'<li id="gy-qishu" class="gy-qishu">'+gdata.yearnum+'</li>'+
'<li id="gy-diqu" class="gy-diqu">'+gdata.RegionName+'</li>'+
'<li id="gy-clmc" class="gy-clmc" style="padding-left:0; width:250px;">'+gdata.clmc+'</li>'+
'<li id="gy-tzsx" class="gy-tzsx" style="width:250px;">'+gdata.tzsx+'</li>'+
'<li id="gy-dw" class="gy-dw">'+gdata.danwei+'</li>'+
'<li id="gy-zdj" class="gy-zdj">¥'+gdata.zhidaojia+'</li>'+
'<div style="clear:both; float:none;"></div>'+
'</a>'+
'</ul>'+
'</div>';
$('#news2017').on('click','ul a.join_se',function(e){
e.preventDefault();
var join_se = $('.join_se').html();
var yearnum = $('#gy-qishu').html();
var RegionName = $('#gy-diqu').html();
var clmc = $('#gy-clmc').html();
var tzsx = $('#gy-tzsx').html();
var danwei = $('#gy-dw').html();
var zhidaojia = $('#gy-zdj').html();
var html =
'<div class="model_join">'+
'<div class="model_box">'+
'<div>'+
'<h2>指导价</h2>'+
'</div>'+
'<div style="clear:both;padding-top:20px">'+
'<table style="width:490px; " border="1px" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">材料名称:</td> '+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px; color:red" colspan="3">'+clmc+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">期数:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+yearnum+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">地区:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+RegionName+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">特征属性:</td>'+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px" colspan="3">'+tzsx+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">单位:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+danwei+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">指导价:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+zhidaojia+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div style="text-align: center" class="imgUpdata_btn_box">'+
'<input type="button" class="join_close" value="关闭">'+
'</div>'+
'</div>'+
'</div>';
$('body').append(html);
});
});
我想通过点击a标签做div弹出层,可是现在每次都只获取第一条信息,无法获取到我点击的数据,请大神们帮帮忙
gpHtml += '<div class="tab-list">'+
'<ul id="myul">'+
'<a href="#?Mid='+gid+'" class="join_se">'+
'<li id="gy-qishu" class="gy-qishu">'+gdata.yearnum+'</li>'+
'<li id="gy-diqu" class="gy-diqu">'+gdata.RegionName+'</li>'+
'<li id="gy-clmc" class="gy-clmc" style="padding-left:0; width:250px;">'+gdata.clmc+'</li>'+
'<li id="gy-tzsx" class="gy-tzsx" style="width:250px;">'+gdata.tzsx+'</li>'+
'<li id="gy-dw" class="gy-dw">'+gdata.danwei+'</li>'+
'<li id="gy-zdj" class="gy-zdj">¥'+gdata.zhidaojia+'</li>'+
'<div style="clear:both; float:none;"></div>'+
'</a>'+
'</ul>'+
'</div>';
$('#news2017').on('click','ul a.join_se',function(e){
e.preventDefault();
var join_se = $('.join_se').html();
var yearnum = $('#gy-qishu').html();
var RegionName = $('#gy-diqu').html();
var clmc = $('#gy-clmc').html();
var tzsx = $('#gy-tzsx').html();
var danwei = $('#gy-dw').html();
var zhidaojia = $('#gy-zdj').html();
var html =
'<div class="model_join">'+
'<div class="model_box">'+
'<div>'+
'<h2>指导价</h2>'+
'</div>'+
'<div style="clear:both;padding-top:20px">'+
'<table style="width:490px; " border="1px" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">材料名称:</td> '+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px; color:red" colspan="3">'+clmc+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">期数:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+yearnum+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">地区:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+RegionName+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">特征属性:</td>'+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px" colspan="3">'+tzsx+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">单位:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+danwei+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">指导价:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+zhidaojia+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div style="text-align: center" class="imgUpdata_btn_box">'+
'<input type="button" class="join_close" value="关闭">'+
'</div>'+
'</div>'+
'</div>';
$('body').append(html);
});
});
我想通过点击a标签做div弹出层,可是现在每次都只获取第一条信息,无法获取到我点击的数据,请大神们帮帮忙
解决方案 »
- form样式请教(text不可编辑、且变灰色)
- js弹出div显示当前页面的预览效果?
- submit 提交后执行问题,虽然分少了点,但是这是我全部的分数了~
- parent.custright.document.getElementById什么意思?
- javascript脚本中如果实现滑动块的效果,谢谢......
- 如何判断一个数组变量是否存在啊?为什么每个版本的IE浏览器都不一样!!!!!!
- 用 javacscript和html中<select>标签实现可编辑的 下拉列表
- emu(ston) goldenlove(潇洒.net)看过来
- ASP+ 为何物
- 表单的纵向,横向,全部的选择功能
- javascript浏览器控制台读取JSON的问题
- 文件上传IE8执行时new ActiveXObject("Scripting.FileSystemObject")无法创建对象
gpHtml += '<div class="tab-list">'+
'<ul id="myul">'+
'<a href="#?Mid='+gid+'" class="join_se">'+
'<li id="gy-qishu" class="gy-qishu">'+gdata.yearnum+'</li>'+
'<li id="gy-diqu" class="gy-diqu">'+gdata.RegionName+'</li>'+
'<li id="gy-clmc" class="gy-clmc" style="padding-left:0; width:250px;">'+gdata.clmc+'</li>'+
'<li id="gy-tzsx" class="gy-tzsx" style="width:250px;">'+gdata.tzsx+'</li>'+
'<li id="gy-dw" class="gy-dw">'+gdata.danwei+'</li>'+
'<li id="gy-zdj" class="gy-zdj">¥'+gdata.zhidaojia+'</li>'+
'<div style="clear:both; float:none;"></div>'+
'</a>'+
'</ul>'+
'</div>';
$('#news2017').on('click','ul a.join_se',function(e){
e.preventDefault();var join_se = $('.join_se').html();
var yearnum = $('#gy-qishu').html();
var RegionName = $('#gy-diqu').html();
var clmc = $('#gy-clmc').html();
var tzsx = $('#gy-tzsx').html();
var danwei = $('#gy-dw').html();
var zhidaojia = $('#gy-zdj').html();
var html =
'<div class="model_join">'+
'<div class="model_box">'+
'<div>'+
'<h2>指导价</h2>'+
'</div>'+
'<div style="clear:both;padding-top:20px">'+
'<table style="width:490px; " border="1px" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">材料名称:</td> '+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px; color:red" colspan="3">'+clmc+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">期数:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+yearnum+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">地区:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+RegionName+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">特征属性:</td>'+
'<td style="width: 100px; height: 40px; text-align: center; word-break:break-all; font- size: 13px" colspan="3">'+tzsx+'</td>'+
'</tr>'+
'<tr>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">单位:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+danwei+'</td>'+
'<td style="width: 30px; height: 40px; text-align: right; font-size: 13px; font-weight: bold">指导价:</td>'+
'<td style="width: 50px; height: 40px; text-align: center; font-size: 13px">'+zhidaojia+'</td>'+
'</tr>'+
'</table>'+
'</div>'+
'<div style="text-align: center" class="imgUpdata_btn_box">'+
'<input type="button" class="join_close" value="关闭">'+
'</div>'+
'</div>'+
'</div>';
$('body').append(html);
});
});这是代码