Push/pop values in array + disabling buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jydmon
    New Member
    • Mar 2007
    • 4

    #1

    Push/pop values in array + disabling buttons

    hello all
    i have a problem with my javascript coding.
    i don't know if anyone can help me.
    pls reply if you can help me
    regards
  • javakid
    New Member
    • Mar 2007
    • 23

    #2
    Originally posted by Jydmon
    hello all
    i have a problem with my javascript coding.
    i don't know if anyone can help me.
    pls reply if you can help me
    regards


    Every body is here to help only .
    Please put your code and ask whatever issues you have.

    Regards

    Comment

    • Jydmon
      New Member
      • Mar 2007
      • 4

      #3
      ok

      what iu actually want to do is to be able to push values in the content to the back stack,pop from back stack to the content, push to the front stack and disable the backward and forward button if not in use.

      below is my whole code

      [HTML] <html>

      <head>
      <script>
      var Display=new Array ()
      var Display2=new Array ()
      var Display3=new Array ()

      function ClickEnter(){

      var item=myTest.con tent.value;
      Display.push(it em);
      myTest.content. value=myTest.ur l.value;
      myTest.back.val ue=Display
      }

      function GoBack (){

      var item2=myTest.co ntent.value;
      Display2.push(i tem2);
      myTest.front.va lue=Display2;

      var item=myTest.bac k.value;
      Display.pop();
      myTest.content. value=item;

      }

      function GoForward (){

      var item=myTest.con tent.value;
      Display3.push(i tem);
      myTest.back.val ue=Display3;


      var item=myTest.fro nt.value;
      Display.pop();
      myTest.content. value=item;
      }

      function disableBackward (){
      var backward=false( );
      if(backward == true) { return; }
      myTest.front.va lue();
      myTest.backward .disabled = true;
      backward=true;
      }


      </script>
      <title>THE BROWSER NAVIGATION DEMONSTRATOR</title>
      </head>

      <body bgcolor="#FFFF0 0">

      <div style="border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1">
      <p align="center"> <b><font size="5" face="Eras Bold ITC">THE BROWSER
      NAVIGATION DEMONSTRATOR</font></b></div>
      <form name="myTest">
      <p align="center"> <b><font size="2">URL:</font></b> <input name="url" type="text" value=0 size="20">
      &nbsp;&nbsp;&nb sp;
      <input type="button" value="Enter" name="Enter" Onclick="ClickE nter()"></p>
      <p align="center"> <b><font size="2">DISPLA Y:</font></b> <input name="content" type="text" value=0 size="20"></p>
      <p align="center"> <textarea rows="8" name="back" cols="20"></textarea>
      &nbsp;&nbsp;&nb sp;
      <textarea rows="8" name="front" cols="20"></textarea></p>
      <p align="center"> <input type="button" value="Backward " name="Backward" Onclick="GoBack ()" Onclick="disabl eBackward()" >
      <input type="button" value="Forward" name="Forward" Onclick="GoForw ard()"></p>
      <p>&nbsp;</div>
      </form>

      </body>

      </html>
      [/HTML]

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Changed thread title

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Javascript is case-sensitive.

          Both forward and backward should be disabled at first because there shouldn't be anything when you begin.
          Last edited by acoder; Mar 20 '07, 10:54 AM. Reason: Grammar

          Comment

          • Jydmon
            New Member
            • Mar 2007
            • 4

            #6
            hey thanks for the reply.
            but can you please help me refine my code for disabling a button cos mine does not work.
            cheers

            Comment

            • Jydmon
              New Member
              • Mar 2007
              • 4

              #7
              yeah thanks, that is exactly what i want to do but i can not do it. if you could show me how to do it..
              thanks

              Originally posted by acoder
              Javascript is case-sensitive.

              Both forward and backward should be disabled at first because they shouldn't be anything when you begin.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Set them to disabled by setting the disabled attribute:
                [HTML]<input type="button" value="Backward " name="Backward" Onclick="GoBack ()" Onclick="disabl eBackward()" disabled>
                <input type="button" value="Forward" name="Forward" Onclick="GoForw ard()" disabled>[/HTML]

                Comment

                Working...