I'm stuck on the last assignment for my Javascript class:


Basically, I am building a band name generator that shows a genre picked via radio buttons. I can't get the images or genre to appear via my getValue function, which seems to always show up as undefined. Any help would be greatly appreciated!

Here's parts of the code:

var whichGenre = document.myForm.genre.value;
function getValue(whatGenre) {
whichGenre = whatGenre;
}//end of getValue function

function process(){
var theName = document.myForm.firstName.value;
var myNumber = document.myForm.number.value;
var nouns = document.myForm.s.value;
var gen = whichGenre;
var genImg = whichGenre+".jpg";

var cookieElements = theName + "***" + myNumber + "***" + nouns + "***" + gen + "***" + genImg + "***";
//the escape method takes what cookieElements is holding and encodes it into ASCII code.
document.cookie = escape(cookieElements) +"; expires=" + ["Thursday, 01 Jan 2009 08:00:00 GMT"];

window.location = "getCookieInfo.htm";
}//end of process function

<span>Choose your band's sound:</span>
<span id="bandID" style="display: none;">Text</span><br>
<span class="radioOptions">
<input name="genre" value="Metal" onClick="getValue(this.id)" onChange="bandCheck()" type="radio">Heavy<br />
<input name="genre" value="Punk" onClick="getValue(this.id)" onChange="bandCheck()" type="radio">Edgy<br />
<input name="genre" value="Emo" onClick="getValue(this.id)" onChange="bandCheck()" type="radio">Emotional<br />
<input name="genre" value="Indie" onClick="getValue(this.id)" onChange="bandCheck()" type="radio">Original<br />
<input name="genre" value="Pop" onClick="getValue(this.id)" onChange="bandCheck()" type="radio">Popular<br /><br />
<input value="Generate Band Name" onClick="checkForm()" type="button">