这可以用jQuery或其他方法吗?基本上,我在屏幕上显示的div中有一个书签超链接。它链接到另一个未显示的div中的书签标签。当用户单击书签链接时,是否有可能检测包含书签的div的属性并将div显示设置为显示?
<div class="cpecontent" id="content_2">
<h2><br />
<a name="0.1__Toc320283140"> </a> <a name="0.1__Toc325358918"> </a>Determine All Sources of Income (Taxable and Non-Taxable)</h2>
<p><br />
Reaching into the bag you pull out an amorphous jumble of paper. There are receipts, a stapled stack of credit card statements, a few 1099s, a W-2, a manila envelope labeled "investments," some check stubs, and one artificial fingernail. "What is all this?" you inquire. </p>
<p><br />
"Monday nights at 6:15. It's all about the lottery and I play a woman who runs this magical machine that grabs numbered ping pong balls. It's like a big popcorn machine. My character presses a button that makes the machine grab a ball out of the air. When the machine grabs a ball, she has to turn it so the number faces the camera. There's no dialogue yet, but my manager says they're probably going to expand my role." </p>
<p><br />
<!--ON Click for this Bookmark, set the div below to display:show;-->
<a href="#0.1__Gross_Income" title="_Gross_Income"> <span> For more on this topics - see Appendix A </a> </p>
</div>
<!--A LOT OF CONTENT IN BETWEEN-->
<!--This DIV is hidden right now, but we want to try and show it-->
<div class="cpecontent" id="content_11" style="display:none;">
<h2><br />
<a name="0.1__Toc325358937"> </a> <a name="0.1__Gross_Income"> </a>Gross Income</h2>
<p><br />
All of the following constitute possible sources of Gross Income:</p>
<p style="margin-bottom:0pt;line-height:12pt">Wages</p>
<p style="margin-bottom:0pt;line-height:12pt">Self-employment income</p>
<p style="margin-bottom:0pt;line-height:12pt">Partnership and S corporation income</p>
</div>
答案 0 :(得分:0)
$('a[href^="#"]').click(function(){
$('a[name="'+this.href.replace('#', '')+'"]').show();
});
BTW我认为这些链接被称为锚点而不是书签。