Forum Moderators: open
I am working on a simple javascript quiz page. Instead of having poping up a new window/page to display the results, I would like it to be in the same window...below is my script. What should I do? I tried taking out the window.open part and wrote window.location that didn't work. Thanks guys!
<script>
function wizard()
{
url = '';
if (document.finder.radio0[0].checked) {
url = url + '1';
} else {
url = url + '2';
}
if (document.finder.radio1[0].checked) {
url = url + '1';
} else {
url = url + '2';
}
if (document.finder.radio2[0].checked) {
url = url + '1';
} else if (document.finder.radio2[1].checked) {
url = url + '2';
} else {
url = url + '3';
}
if (document.finder.radio3[0].checked) {
url = url + '1';
} else {
url = url + '2';
}
url = 'answer.html?' + url + '00';
//alert(url);
var win = window.open(url, 'Product');
win.focus();
return true;
}
</script>
var win = window.open(url, 'Product'); --> you don't want to open a new window or even stay on the page. No reason for a variable either.
win.focus(); --> No reason to focus only one window
return true; --> You not returning anything. You want to load a new page.
Delete these three lines and try putting
window.location=url;
I am not certain it will work I haven't tried it, but it would be where I would start.