Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to find asp controls on page at client side(run time)?

How to find asp controls on page at client side(run time)?

Scheduled Pinned Locked Moved Visual Basic
javascripthelptutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JayPrakash Kulkarni
    wrote on last edited by
    #1

    I have to add reset function in my project which will be called on every page and it will find out all the asp controls of a page at run time and reset them. Can any on help me in this.............. (I need this using JavaScript)

    C 1 Reply Last reply
    0
    • J JayPrakash Kulkarni

      I have to add reset function in my project which will be called on every page and it will find out all the asp controls of a page at run time and reset them. Can any on help me in this.............. (I need this using JavaScript)

      C Offline
      C Offline
      Costica U
      wrote on last edited by
      #2

      You can use something like this. function Reset() { var inputs = document.getElementsByTagName('input'); var textareas = document.getElementsByTagName('textarea'); for (var i = 0; i < inputs.length; i++) { if (inputs[i].type && inputs[i].type.toLowerCase()=='text') { inputs[i].value=''; } } for (var i = 0; i < textareas.length; i++) { textareas[i].value=''; } }

      J 1 Reply Last reply
      0
      • C Costica U

        You can use something like this. function Reset() { var inputs = document.getElementsByTagName('input'); var textareas = document.getElementsByTagName('textarea'); for (var i = 0; i < inputs.length; i++) { if (inputs[i].type && inputs[i].type.toLowerCase()=='text') { inputs[i].value=''; } } for (var i = 0; i < textareas.length; i++) { textareas[i].value=''; } }

        J Offline
        J Offline
        JayPrakash Kulkarni
        wrote on last edited by
        #3

        Thanks a lot Costica, I am able to reset TextBoxes but not DropDown using this code, can you please help in this. -- modified at 3:21 Wednesday 18th October, 2006

        C 1 Reply Last reply
        0
        • J JayPrakash Kulkarni

          Thanks a lot Costica, I am able to reset TextBoxes but not DropDown using this code, can you please help in this. -- modified at 3:21 Wednesday 18th October, 2006

          C Offline
          C Offline
          Costica U
          wrote on last edited by
          #4

          This is the updated function:

          function Reset()
          {
          var inputs = document.getElementsByTagName('input');
          var textareas = document.getElementsByTagName('textarea');
          var lists = document.getElementsByTagName('select');
          for (var i = 0; i < inputs.length; i++)
          {
          if (inputs[i].type && inputs[i].type.toLowerCase()=='text')
          {
          inputs[i].value='';
          }
          }
          for (var i = 0; i < textareas.length; i++)
          {
          textareas[i].value='';
          }
          for (var i = 0; i < lists.length; i++)
          {
          lists[i].selectedIndex =-1;
          }
          }

          J 1 Reply Last reply
          0
          • C Costica U

            This is the updated function:

            function Reset()
            {
            var inputs = document.getElementsByTagName('input');
            var textareas = document.getElementsByTagName('textarea');
            var lists = document.getElementsByTagName('select');
            for (var i = 0; i < inputs.length; i++)
            {
            if (inputs[i].type && inputs[i].type.toLowerCase()=='text')
            {
            inputs[i].value='';
            }
            }
            for (var i = 0; i < textareas.length; i++)
            {
            textareas[i].value='';
            }
            for (var i = 0; i < lists.length; i++)
            {
            lists[i].selectedIndex =-1;
            }
            }

            J Offline
            J Offline
            JayPrakash Kulkarni
            wrote on last edited by
            #5

            Thanks again Costica, I have to add one more functionality to reset radioButton as well as checkBoxes to this function please help in this.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups