好的,所以我有一个问题,我有一个简单的html网站充满了文本,我想使按钮有一个onclick功能,使我的窗口(在页面的时刻的位置)找到一个元素,id="元素"和改变窗口的位置。类似于ctrl +F函数,但没有突出显示
元素<head>
<script>
function h1Location(){
enter code here
}
</script>
</head>
<body>
<header >
<div style="position:fixed;">
<input type="button" onclick="h1Location()" />
</div>
</header>
<nav>
<h1 id="firstHeader" >TEXT</h1>
</nav>
</body>
所以在这种情况下,我只是想让按钮定位并将PageView更改为'TEXT'(h1 with id=" firsttheader "),所以它不是向上或向下滚动,而是立即为您做。
In page anchor links:
Click <a href="#placeToScroll">here</a> to see some lower down part the author thinks is important.
<!--REST OF PAGE-->
<a name="placeToScroll">Here's that lower down part!</a>