Find and HTML Element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Heavey

    Find and HTML Element

    If I have an HTML element, say a <p> tag with and ID="Fred", how do I find
    that element? I want to set the Style attribute to "hidden", how do I do
    that?

    Thanks!!!
  • Marina

    #2
    Re: Find and HTML Element

    document.getEle mentById('Fred' )

    "Jim Heavey" <JimHeavey@disc ussions.microso ft.com> wrote in message
    news:713B752E-AEA2-45B6-90F3-F94FC459B1ED@mi crosoft.com...[color=blue]
    > If I have an HTML element, say a <p> tag with and ID="Fred", how do I find
    > that element? I want to set the Style attribute to "hidden", how do I do
    > that?
    >
    > Thanks!!![/color]


    Comment

    • darrel

      #3
      Re: Find and HTML Element

      > If I have an HTML element, say a <p> tag with and ID="Fred", how do I find[color=blue]
      > that element? I want to set the Style attribute to "hidden", how do I do
      > that?[/color]

      If this is to toggle items on/off on screen, then this is probably a job for
      javascript.

      If it's to toggle items on/off via a postback, then I'd just use
      labels/placeholders to hold the content and set those visbible states in the
      codebehind.

      Otherwise, you can put a runat="server" in the P tag and access it that way.

      -Darrel


      Comment

      • Jim Heavey

        #4
        Re: Find and HTML Element

        I am using javascript to turn on and off an error message based on an edit
        which is imposed in the javascript. But when the page comes back to the
        server I am going to run the test again at the server and hence I want to
        turn the message on if I detect and error.

        OK, I place a "runat="ser ver" and then access, but I'm still not sure what
        the code would look like to change the visibility property and I am not sure
        which class I should use for the <P> element. Is this equate to the
        "HtmlContainerC ontrol"? That has no "Attibutes" property. Maybe I should
        use the plain "HtmlContro l"?


        Comment

        Working...