I'm currently working on a Java project to develop a name generator. I have successfully implemented basic functionality using tables. However, I am now looking to enhance this by allowing the script to seamlessly switch between tables using radio buttons.
For example, instead of having to select from both male and female names, I would like the user to be able to choose either male or female options. Does anyone have any suggestions on how I can achieve this?
window.onload = initAll;
function initAll() {
document.getElementById("sillySubmit").onclick = function() {
document.getElementById("msgField").innerHTML = getSillyName();
return false;
}
}
if(document.getElementById('gender_Male').checked) {
}else if(document.getElementById('gender_Female').checked) {
}
function getSillyName() {
var firstName = ["My", "First", "Name"];
var middleName = ["My", "Second", "Name"];
var lastName1 = ["My", "Third", "Name"];
var lastName2 = ["My", "Fourth", "Name"];