rejetto forum

java script question

kaler · 5 · 3175

0 Members and 1 Guest are viewing this topic.

Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
in my last post i had a script, which deactivate your account, when you put in the rigth code.

Now i have a question:

My script is activate, when you put in the wrong code and then it abort the request
and it is activated, when the user out in the rigth code, and there is an alert : "do you want to delet your account."

But i dont know how i make two butten (ok and reset) i can only one withe he funktion yes or no. can you help me

Here the code:

Code: [Select]
<script type="text/javascript">
function validateCode(form){
if (form.code1.value != form.code2.value){
alert("%user%! The Code is wrong. Please try again.");
return false;
  }
if (form.code1.value = form.code2.value){
alert("%user%! Do you want really to delet your account?");
return true;<-- Here is the button which says jes-->
return false;<--but this bottun don't work-->
  }
return true
}
</script>


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
can nobody say me, how i can make a alert with 'ok' and 'abort'....

thank you if you did it...


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
use confirm() instead of alert()

Remember that this is a hfs related forum, for elementary javascript manuals google, you will find there texts in your language. ;)
your computer has no brain - use your own !


Offline kaler

  • Occasional poster
  • *
    • Posts: 94
    • View Profile
jeha i know... but when i came with the macros they ask me why i don't use php  then i must say, that i must use a very good program, and then they are laughing, so i put my questions here... ( ok by javascript i can use other forums... sorry)


buit thank you for help it works fantastic...


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Code: [Select]
function validateCode(form) {
  if (form.code1.value != form.code2.value) {
      alert("%user%! The Code is wrong. Please try again.");
      return false;
  }
  return confirm('do you really want?');
}
« Last Edit: September 04, 2009, 02:43:43 PM by rejetto »