Form - click button to new page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemong
    New Member
    • May 2007
    • 4

    Form - click button to new page

    Hi, wondering if anyone can help me
    I have created a form and user id, password that allows the user to submit and all this works fine however I want to create another button next to the ' > ' submit button within the form that when pressed sends you to another page (register.asp) so that a customer could register there details if they wanted to view the site. Hope this makes sense. I just want a customer to able to press a button that sends them to another page –


    See code below

    Grateful if anyone can offer any help
    Thanks Hemong

    Code: ( html4strict )

    <script language="JavaS cript" type="text/JavaScript">
    <!--



    var mmWindow;
    function windowOpener() {
    if (!mmWindow || mmWindow.closed ){mmWindow=wind ow.open('where_ to_fi nd_us.htm','the window','width= 650,height=570, top=1 0,left=50, resizable,menub ar,statusbar,to olbar,scrollbar s');}
    else{
    mmWindow.close( );
    mmWindow=window .open('where_to _find_us.htm',' thewi ndow','width=65 0,height=570,to p=10,left=50, resizable,menub ar,statusbar,to olbar, scrollbars');
    }
    }

    function setDomain() {
    var liBehindFirstDo t = document.domain .indexOf( "." ) + 1;
    if (liBehindFirstD ot > 0) {
    document.domain = document.domain .substr( liBehindFirstDo t );
    }
    }
    setDomain();

    function submitLogin(frm Login) {

    // Get username and password from user input

    var myLogin = new String(frmLogin .elements["username"].value);
    var myPassword = new String(frmLogin .elements["password"].value);

    // Check that both username and password are entered

    if (myLogin == "" || myPassword == "") {
    alert("Please enter a username and password");
    }
    else {
    // Login via javalogin

    // alias: username
    // password: password
    // contact: contact department - Displayed if login fails
    // phone: phone number - Displayed if login fails
    // logout_url: Logout url

    frmLogin.action = "https://pgw100.portal.g ases.boc.com/javalogin/javalogin.jsp?a lias=" + myLogin + "&password= " + myPassword + "&contact=B OC Customer Service&phone=0 800 111 333&logout_url= http://www.bocindustri al.co.uk";
    //frmLogin.submit ();
    }

    }

    function MM_preloadImage s() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.leng th,a=MM_preload Images.argument s; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    //-->
    </script>
    1. <form name="formLogin " method="post" onSubmit="javas cript:submitLog in(formLogin);" target="_blank" >
    2. User name
    3. <input type="text" name="username" class="input" size="20" />
    4. Password
    5. <input type="password" name="password" class="input" size="15" />
    6. <label>
    7. <input type="submit" name="submit" value=" > " />
    8. </label>
    9. <label></label>
    10. <input type="submit" name="Submit" value="Register " /></a>
    11. </form>
  • merseyside
    New Member
    • Mar 2007
    • 48

    #2
    If you don't want any data from the current page passed to the script would a simple link suffice and perhaps CSS it? If you really want a button and CSS'ing isn't sufficient, have you tried an input type of button with an onclick event?

    Briefly...
    Code:
    function gotoRegister()
    {
       document.location.href = "register.asp";
    }
    
    <input type="button" name="regbtn" value="&gt;" onclick="gotoRegister()" />

    Comment

    • pavancognizant
      New Member
      • May 2007
      • 7

      #3
      In input type specify the src attribute to your image for next and onclick call gotoRegister function.....

      <input type="image" name="" src="/next.gif" onclick="return gotoRegister()" >

      Originally posted by merseyside
      If you don't want any data from the current page passed to the script would a simple link suffice and perhaps CSS it? If you really want a button and CSS'ing isn't sufficient, have you tried an input type of button with an onclick event?

      Briefly...
      Code:
      function gotoRegister()
      {
         document.location.href = "register.asp";
      }
      
      <input type="button" name="regbtn" value="&gt;" onclick="gotoRegister()" />

      Comment

      Working...