link define and submit by javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MATTXtwo
    New Member
    • Sep 2006
    • 83

    link define and submit by javascript

    i have a code like this
    Code:
    var total=document.getElementById("pagelimit").value;
    	var choice=confirm("Adakah anda pasti untuk set semula password bagi "+total+" rekod\!\nAre you sure to reset password for "+total+" record\!");
    	if (choice)
    	{	
    	str="http:\\somethingurl";
    
    	}else{
    	str="http:\\somethingurl";	
    	}
    so i want to make javascript to redirect to that str variable
    mabe like this command:
    Code:
    document.link("str");
    please make me know if this is correct
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Hey.

    Check out this.

    Comment

    • MATTXtwo
      New Member
      • Sep 2006
      • 83

      #3
      Originally posted by Markus
      Hey.

      Check out this.
      thanks that rights..
      Code:
      onclick="javascript: ConfimForm();return false;"
      but must typein this on the button if not the form will submit to the link that define on form tag...sure we don't want that

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You can either just use window.location .href directly, or when submitting, change the action of the form depending upon the confirm response from the user.

        Comment

        Working...