通过dom关系获取,传入this,不需要id
<div id="yhj-info" class='stamp stamp02' onclick="getInfo(this)">
<div class=' par'>
<sub class='sign'>¥500</sub>
<span></span>
<sub>优惠券</sub>
<p>劵号:<font id="num">123123123</font></p>
</div>
<div class='copy'>
副券
<p><br></p>
</div>
<i></i>
</div>
<div id="yhj-info" class='stamp stamp02' onclick="getInfo(this)">
<div class='par'>
<sub class='sign'>¥50</sub>
<span></span>
<sub>优惠券</sub>
<p>劵号:<font id="num">123123123xxxx</font></p>
</div>
<div class='copy'>
副券
<p><br></p>
</div>
<i></i>
</div>
<script>
function getInfo(div) {
var sub = div.getElementsByTagName('sub')[0]; alert(sub.innerHTML)
var font = div.getElementsByTagName('font')[0]; alert(font.innerHTML)
}
</script>