declaring text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aseef
    New Member
    • Oct 2008
    • 8

    declaring text box

    how to declare a textbox in Javascript???
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Can you be more clear in defining your problem/question? What do you mean by declaring a text box? Do you mean creating one and displaying it?

    Comment

    • Aseef
      New Member
      • Oct 2008
      • 8

      #3
      Thank you for ur response. The requirement is like this. i have a java script function 'displayTxtBox( )'. i just want pass the text boxes names while calling this function. can you helpme? how can ido that?

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        i don't understand this ... are the textboxes just hidden or do you need to create them dynamically first? ... the function should just receive the name of the box - what should exactly happen then? please show what you have done so far and give an example for the wished behaviour ...

        kind regards

        Comment

        • Aseef
          New Member
          • Oct 2008
          • 8

          #5
          the text boxes will be hidden at the page load. in the fuction i have wriiten the code to make it visible. please see the below mail

          Code:
          function displayCalibTxt()
           {
             document.Form1.TxtCalib1.style.display='block'
             document.Form1.TxtCalib2.style.display='block'
          }
          so instead of writing the text boxes id one by one. can i pass the text box id as parameter?
          Last edited by acoder; Oct 27 '08, 11:48 AM. Reason: changed [i] to [code] tags

          Comment

          • Aseef
            New Member
            • Oct 2008
            • 8

            #6
            please let me know if you want it more clear

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Originally posted by Aseef
              so instead of writing the text boxes id one by one. can i pass the text box id as parameter?
              Yes, of course.
              Code:
              function displayTxtBox(id) {
                  document.getElementById(id).style.display='block';
              }
              Remember to make sure the ID is unique.

              Comment

              • Aseef
                New Member
                • Oct 2008
                • 8

                #8
                Thank you very much for the prompt help

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  No problem. Post again if you have more questions :)

                  Comment

                  • Aseef
                    New Member
                    • Oct 2008
                    • 8

                    #10
                    Am sorry to bother u guys. i tried to make the function as above. an d i called the function like
                    <TD onclick="displa yText(TxtID)">< INPUT id="TxtID" style="WIDTH: 39px; HEIGHT: 22px" type="text" size="1" name="Txt1></TD>

                    but i am getting error. can you pls help me.

                    Comment

                    • Aseef
                      New Member
                      • Oct 2008
                      • 8

                      #11
                      can anyone help me please. please let me know if it wanted to be more clear.

                      Comment

                      • Aseef
                        New Member
                        • Oct 2008
                        • 8

                        #12
                        Yes. I got it. i misssed quotes while passing the parameter.

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          Yes, that's correct. Well done- you managed to solve it yourself.

                          Comment

                          Working...