Simple Stuff...for someone..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bpnet
    New Member
    • Oct 2006
    • 2

    Simple Stuff...for someone..

    Hi am wondering if u can give me a little help with some code. Im a little new to JS so please bare with me :)

    Im creating a login code for our clients to visit a section on our website that is personnal to them. I wanted to stay away from the php side for this website.

    The section does not need to be very secure, but the code i have at the moment allows the users to log in but it does not open a new browser window, it opens the page in the current browser window which obviously shows the URL in the search bar! I want to avoid showing anyone the URL. So i thought about the window.open command. Having a new window pop up will allow me to show the page with no Header search abr or anything i prosume? If so how do i implement this into my code?

    I have attached the section of code im using as the login button.

    if(imgSubmit == ""){
    document.write( '<input type="button" value="Logon" name="Logon" onclick="login( username.value, password.value, window.open)">' );
    } else {
    document.write( '<input type="image" src="'+imgSubmi t+'" name="Logon" onclick="login( username.value, password.value) ">');
    }

    This is my code for the login button used in JS. I just want to know where to put the window.open line of code. I think its within the onclick line but im not sure!

    Any help would be much appreciated :)

    Cheers.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by bpnet
    Hi am wondering if u can give me a little help with some code. Im a little new to JS so please bare with me :)

    Im creating a login code for our clients to visit a section on our website that is personnal to them. I wanted to stay away from the php side for this website.

    The section does not need to be very secure, but the code i have at the moment allows the users to log in but it does not open a new browser window, it opens the page in the current browser window which obviously shows the URL in the search bar! I want to avoid showing anyone the URL. So i thought about the window.open command. Having a new window pop up will allow me to show the page with no Header search abr or anything i prosume? If so how do i implement this into my code?

    I have attached the section of code im using as the login button.

    if(imgSubmit == ""){
    document.write( '<input type="button" value="Logon" name="Logon" onclick="login( username.value, password.value, window.open)">' );
    } else {
    document.write( '<input type="image" src="'+imgSubmi t+'" name="Logon" onclick="login( username.value, password.value) ">');
    }

    This is my code for the login button used in JS. I just want to know where to put the window.open line of code. I think its within the onclick line but im not sure!

    Any help would be much appreciated :)

    Cheers.
    java != javascript. There is a javascript forum on this site where you are likely to get better help than you'll get here.

    My bet will be that you put the window.open inside the function login

    Comment

    • accelua1
      New Member
      • Oct 2006
      • 5

      #3
      hey just try this one...

      u can just call a java script function while submitting the form as

      onclick ="return submitLoginForm ();"

      u can just include the window.open command as

      <script type="text/javascript">
      function submitLoginForm ()
      {
      alert(document. forms[0].username.value );
      alert(document. forms[0].password.value );
      window.open(' @@@',' ',' width=550,heigh t=500 ');
      document.forms[0].submit();
      return true;
      }
      }
      </script>

      @@@ - u can give ur URL there
      u can simple get the username and password values by document.forms[0].username.value ,document.forms[0].password.value .

      Comment

      Working...