キーを押すと一度に 1 つずつ表示したい文字列の配列があります。歌詞のクラスを持つ空の 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に出力する方法が混乱しています