By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

link define and submit by javascript

P: 83
i have a code like this
Expand|Select|Wrap|Line Numbers
  1. var total=document.getElementById("pagelimit").value;
  2.     var choice=confirm("Adakah anda pasti untuk set semula password bagi "+total+" rekod\!\nAre you sure to reset password for "+total+" record\!");
  3.     if (choice)
  4.     {    
  5.     str="http:\\somethingurl";
  6.  
  7.     }else{
  8.     str="http:\\somethingurl";    
  9.     }
so i want to make javascript to redirect to that str variable
mabe like this command:
Expand|Select|Wrap|Line Numbers
  1. document.link("str");
please make me know if this is correct
Nov 17 '08 #1
Share this Question
Share on Google+
3 Replies


Markus
Expert 5K+
P: 6,050
Hey.

Check out this.
Nov 17 '08 #2

P: 83
Hey.

Check out this.
thanks that rights..
Expand|Select|Wrap|Line Numbers
  1. 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
Nov 17 '08 #3

acoder
Expert Mod 15k+
P: 16,027
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.
Nov 17 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.