PDA

View Full Version : Opening a new page in the same window


t_muffazal
Dec 6, 2002, 06:27 AM
Hi
I have a simple problem. The script given below works fine but the problem is that it doesn't open the pages "success.htm" and "failure.htm" depending upon the conditions. The problem is in the script lines given:

Document.location.href = "success.htm"
Document.location.href = "failure.htm"

What should I write so that "success.htm" and "failure.htm" pages should be opened according to the condition satisfied and in the same window. Thanks in advance.

The Script :

<script language = JavaScript>
Function validate()
{
Var staticuid = "demouid"
Var staticpwd = "demopwd"

Var extractuid = document.form.username.value
Var extractpwd = document.form.password.value

If(staticuid == extractuid)
{
Document.location.href = "success.htm"
}
Else
{
Document.location.href = "failure.htm"
}
}
</script>

Muffazal

zylstra
Dec 9, 2002, 05:34 AM
I'm not much of a Javascript guru, but have you tried the following?

{
Window.location = "success.htm"
}
Else
{
Window.location = "failure.htm"
}

Also, be sure to check out http://developer.irt.org/script/redirect.htm .

-zylstra

t_muffazal
Dec 10, 2002, 07:35 AM
Hi
Thanks for the reply. I have tried what you have written but still it doesn't work. If possible please give me a solution as soon as possible.

Muffazal

zylstra
Dec 13, 2002, 01:04 PM
Sorry I can't help more.

-zylstra