#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    Open page in the same window


    Hi,

    I need to open a new page in the same window when clicked on submit button. Below is my function code.

    With window.open(), i can open the page in a new window.
    I tried window.open("xxx.jsp",_self) and window.location.href = "xxx.jsp" but can't open the new xxx.jsp page.

    can some one help me how to open it in the same page.

    function check(form)
    {
    if(form.username.value == "" || form.password.value == "")
    {
    alert("xxxxx")
    }
    else if(form.username.value == "xxx" && form.password.value == "xxx")
    {
    window.open("xxx.jsp")
    //window.location.href = "xxx.jsp"
    }
    else
    {
    alert("xxx")
    }
    }
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,169
    Rep Power
    184
    You wouldn't use window.open() to submit the form to the same page; you would just submit the form values to your current page. Which if you write your server side code correctly... your server side code will get your form values; once the page is submitted to itself.

IMN logo majestic logo threadwatch logo seochat tools logo