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. Web Development
  3. ASP.NET
  4. Problem with javascript

Problem with javascript

Scheduled Pinned Locked Moved ASP.NET
helpjavascripttutorial
4 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.
  • S Offline
    S Offline
    SunithaNallana
    wrote on last edited by
    #1

    hi... In my .aspx file i have a div tag. i am calling javascript function programatically ie. Response.Write("hide();"); at page load event 'coz i want to hide it initially and show the div tag when needed. For hide() i wrote function hide() { document.getElementById('pstage').style.display='none';} i am unable to find my error. it often happens that javascript does not work. pls let me know where is the problem and how to rectify it. SunithaNallana

    P 1 Reply Last reply
    0
    • S SunithaNallana

      hi... In my .aspx file i have a div tag. i am calling javascript function programatically ie. Response.Write("hide();"); at page load event 'coz i want to hide it initially and show the div tag when needed. For hide() i wrote function hide() { document.getElementById('pstage').style.display='none';} i am unable to find my error. it often happens that javascript does not work. pls let me know where is the problem and how to rectify it. SunithaNallana

      P Offline
      P Offline
      Prateek G
      wrote on last edited by
      #2

      If u have this div tag under a form which has attribute runat="server". On page load even you can directly write formName.FindControl("divTagId").visible = false; Make sure again that div tag with id = divTagId has an attribute runat="server" else it will give you an error.

      S 1 Reply Last reply
      0
      • P Prateek G

        If u have this div tag under a form which has attribute runat="server". On page load even you can directly write formName.FindControl("divTagId").visible = false; Make sure again that div tag with id = divTagId has an attribute runat="server" else it will give you an error.

        S Offline
        S Offline
        SunithaNallana
        wrote on last edited by
        #3

        hi..

        Prateek G wrote:

        If u have this div tag under a form which has attribute runat="server".

        u r right but i donot want the div tag to be a server side control,i want it to function as client side control

        P 1 Reply Last reply
        0
        • S SunithaNallana

          hi..

          Prateek G wrote:

          If u have this div tag under a form which has attribute runat="server".

          u r right but i donot want the div tag to be a server side control,i want it to function as client side control

          P Offline
          P Offline
          Prateek G
          wrote on last edited by
          #4

          Create a div with visible attribute as false. And when you want to make it visible use the code. document.getElementById('divTagId').removeAttribute('visible'); since by default visible will be true it will be visible In case again based on any condition if you need to make it invisible use this code document.getElementById('divTagId).visible= "false";

          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