0
我想用功能keyPressed()爲演示視圖下一部分我喜歡在沒有像jQuery這樣的框架下做到這一點。如何在javascript中使用keyPressed獲取下一個元素?
調用的方法:
document.addEventListener('keydown', (event) => {
keyPressed();
}
var onPage=3;
function keyPressed(){
let sections = document.getElementByTag("section");
onPage++;
GOTO: sections[onPage] //the href in the a element would be "../#sectionJJ"
}
而且在我的HTML有:
<section>content 1 <section>
<section>content 2<section>
<section>content 3<section>
<section id="section4JJ">content 4<section>
<section>content 5<section>
以及你怎麼去嗎?滾動,顯示,網址等..... – epascarello
什麼是'章節',以及onPage如何與下一個元素相關? – brk
GOTO:Sections [onPage]不起作用 – user3432681