0

これは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>
4

1 に答える 1

0
$('a[href^="#"]').click(function(){
    $('a[name="'+this.href.replace('#', '')+'"]').show();
});

ところで、これらのリンクはブックマークではなくアンカーと呼ばれていると思います。

于 2012-06-06T14:16:55.163 に答える