Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disable/Enable button

    How do i make an button that you need to klick and then when you click it it will "unlock"/enable the next button??

    Please help!

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Western US
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would track it through a variable. Once they click the first button, the set the flag to true. Then on selecting the second button make sure the flag is true before it does whatever it is going to do.

    <script language="javascript" type="text/javascript">
    submitOK = false
    function SetConfirm(){
    submitOK = true;
    document.temp.confirm.value = "Confirmed";
    document.temp.submit1.value = "Submit";
    }

    function checkSubmit(){
    if(submitOK)
    document.temp.submit();
    }

    </script>
    <form name="temp">
    <input type="button" name="confirm" value="Click To Confirm" onClick="SetConfirm()"><br>
    <input type="button" name="submit1" value="Must Confirm" onClick="checkSubmit()">
    </form>

    In that case, there is a visual cue that they did indeed select the button, and submit will work.

    ShriekForth

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks

    But can you make the buttons to images, i know hot to mak an image button but it didn't work with the script!!

    my img code:
    <img border="0" src="img/bottom.gif" width="500" height="13">

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Western US
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Images also support onClicks... you will have to remove this bit

    document.temp.confirm.value = "Confirmed";
    document.temp.submit1.value = "Submit";

    that changes the button values, or you will get an error.


    <img border="0" src="img/bottom.gif" width="500" height="13" onClick="SetConfirm()>
    <img border="0" src="img/bottom2.gif" width="500" height="13" onClick="checkSubmit()>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •