当点击当前页面的按钮时,如何在其他HTML页面中锚定段落并同时高亮指向段落所在的区域?
我用 JavaScript 编写了这个简单的代码,只是做锚点
当前页面:
<html>
<form>
<input type=button value="open in new tab" onClick="goToURL2()">
</form>
<body>
<script type="text/javascript">
<!--
function goToURL2() { window.open( "explanations.html#footwell"); }
// -->
</script>
</body>
</html>
新页面:
<html>
<p><a name="footwell">
O, say can you see by the dawn's early light?
</a></p>
</html>
我认为“突出显示的文本”jQuery 将是最好的方法,但无法弄清楚如何处理多个 html 页面。