I have the following code, I'm trying to determine which button a user presses.
function Navigation(navigating, timed) {
if (navigating == general) {
if (timed) {
window.location.replace('general.html?timed=' + timed);
} else {
window.location.replace('general.html');
}
} else if (navigating == sport) {
if (timed) {
window.location.replace('sport.html?timed=' + timed);
} else {
window.location.replace('sport.html');
}
} else if (navigating == music) {
if (timed) {
window.location.replace('music.html?timed=' + timed);
} else {
window.location.replace('music.html');
}
}
}
<button type="button" id="general" onclick="Navigation(general, null)">General Knowledge</button>
<button type="button" id="sport" onclick="Navigation(sport, null)">Sport</button>
<button type="button" id="music" onclick="Navigation(music, null)">Music</button>
<button type="button" id="generalTimer" onclick="Navigation(general, 'true')">Timed General Knowledge</button>
<button type="button" id="sportTimer" onclick="Navigation(sport, 'true')">Timed Sport</button>
<button type="button" id="musicTimer" onclick="Navigation(music, 'true')">Timed Music</button>
It actually works, however when I get to the next page, I don't know how to get the timed variable to affect the page.