• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

issue in javascript

 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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("--------");
}
}
 
Ranch Hand
Posts: 121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct is

window.location = "home.html"
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Off to HTML / JavaScript!
 
Rodrigo Lopes
Ranch Hand
Posts: 121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happened when you tried window.location = "home.html"?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you could have something like this..



Justin
 
reply
    Bookmark Topic Watch Topic
  • New Topic