wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes issue in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "issue in javascript" Watch "issue in javascript" New topic
Author

issue in javascript

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

I have an hom.html page where i have username and password fields.. I get those values thru JavaScript.. If these things match with my un and pwd it goes to another page.Else it shows an error message. Here the window.location.href is not working. I tried window.open where it opens a new window by leaving the existing window still exists. I need a page opens within the same window just like response.sendRedirct in JSP..Pls sum one help me to resolve this. Any help would be appreciated...



function callme(form)
{
if(document.forms[0].elements[1].value=="ajax" && document.forms[0].elements[2].value=="ajax")
{
window.location.href = "home.html"
}
else
{
alert("--------");
}
}


Never try to be a hard-worker. Be a smart-worker.
My Blog
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
The correct is

window.location = "home.html"
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Hi Rodrigo Lopes
I have tried that too.. But still that wont seems to be working... What can i do...Anyway thanks for your suggestion...Keep on moving
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  19

Off to HTML / JavaScript!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
What happened when you tried window.location = "home.html"?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Rodrigo Lopes:
What happened when you tried window.location = "home.html"?


window.location is not one of the "best practices" of JavaScript. You should use .href as the poster orginally did.


Here the window.location.href is not working.


What is not working? Are you getting an error message? Is the page reloading? Is the world catching on fire? We need some more details and you may want to show us how you are calling your function with a button, link, keyoress etc.

Eric
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
you could have something like this..



Justin


You down with OOP? Yeah you know me!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: issue in javascript