我有一个字符串数组,我想在按键上一次显示一个。我有一个带有歌词类的空 div。使用
$(document).keyup(function(e){
if (event.which==13)
...
我只是对这里的语法感到困惑,我将如何指定此事件将我的数组打印到我的 div。我在这里省略了大部分脚本,因为这是我需要帮助的唯一部分
这里的 HTML 只是一个基本的布局
<html>
<head>
<meta charset="UTF-8">
<title>Rotating Messages</title>
<link href="stylesheets/site.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
var messages=[
"Tonight I\'m gonna have myself a real good time",
"I feel alive and the world it\'s turning inside out Yeah!",
"I\'m floating around in ecstasy",
"So don\'t stop me now don't stop me",
"Cause I\'m having a good time having a good time",
"I\'m a shooting star leaping through the skies",
"Like a tiger defying the laws of gravity",
"I\'m a racing car passing by like Lady Godiva",
"I'm gonna go go go",
"There\'s no stopping me"
];
</script>
</head>
<body>
<div id="wrapper">
<header class="title">
<h1> Fun with Arrays!</h1>
<div class="lyrics"></div>
...
我只是很困惑如何使用按键打印到一个空的 div