我正在做两个简单的新闻页面,方案就像我发布新闻时一样head line and its description on page news.html
,还有一个“更多阅读”按钮when user will click read more button it will take to a page news_detail.html
,现在如果用户单击news.html页面上的第一个新闻,我想要的应该是detal.htmml中的第一个新闻,如果用户点击第二条新闻时,它应该关注第二条新闻,而所有新闻的详细信息都在同一页面上,
我知道如何直接指向同一页面中的特定链接,但是如果我们必须转到另一页面上并且必须专注于特定新闻,它将如何发生?请帮我
为每个新闻指定唯一的ID,如下所示:
<div id="news1">
<!-- news content -->
</div>
<div id="news2">
<!-- news content -->
</div>
<div id="news3">
<!-- news content -->
</div>
...
现在,您可以在将新闻ID附加到URL之后,只需重定向用户,如下所示:
news.html#news1
news.html#news2
news.html#news3
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句