Welcome to WebmasterWorld Guest from 50.19.156.19

Forum Moderators: open

Message Too Old, No Replies

JavaScript Problem Help Guys!

     

jennashton

8:47 pm on Apr 3, 2003 (gmt 0)

10+ Year Member



Hi,

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>

korkus2000

8:49 pm on Apr 3, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



So you tried exchanging

var win = window.open(url, 'Product');
win.focus();
return true;

for

window.location=url;

jennashton

8:54 pm on Apr 3, 2003 (gmt 0)

10+ Year Member



you mean
window.location=url;
var win = window.open(url, 'Product');
win.focus();
return true;
?

or do i need to delte the window.open part.

Thanks,

Jenn

korkus2000

12:03 am on Apr 4, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Try exchanging the 3 lines for just the one.

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.