View Single Post
Old 06-27-2012, 09:46 AM   PM User | #1
meridian
New Coder

 
Join Date: Jun 2012
Posts: 26
Thanks: 25
Thanked 0 Times in 0 Posts
meridian is an unknown quantity at this point
Button for incremental array?

Hi there
I am still new to JavaScript and am trying to work out a small script that functions as flashcards to learn Japanese vocab. The code below shows pretty much what I want to do, however I wish to make the "next" button repeat the script for the next pair of words in the 2 arrays (ie Japanese and it's meaning in English. Any assistance would be greatly appreciated.

[CODE]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Japanese Vocab</title>

</head>
<body>

<h1>Japanese Vocab</h1>
<p id="japanese"></p>
<p id="english">&nbsp;</p>

<button onclick="showEnglish()">Answer</button>
<button onclick="nextWord()">Next word</button>

<script type="text/javascript">
var japanese=new Array("食べる","読む","行く");
var english=new Array("to eat","to read","to go");
document.getElementById("japanese").innerHTML=japanese[0];

function showEnglish()
{
document.getElementById("english").innerHTML=english[0];
}

</script>

</body>
</html>
[CODE]
meridian is offline   Reply With Quote