www.webdeveloper.com
Results 1 to 4 of 4

Thread: "collapsing" text in .NET

  1. #1
    Join Date
    May 2003
    Posts
    37

    "collapsing" text in .NET

    i create a table during run time, using the "table", "row", and "cell" methods...

    i want to show the first line of the subject, and when the user click it- to open the text. i know i should use javascript, so i used literal control in the tables cell's to hold the text.

    what i tried to do is to add "<div id = 'text' style='displey:none'>" in the literal, and "onclick" method to the link button.

    and then i used this function:
    <script language="javascript">
    function show ()
    {
    document.getElementById('text').style.display = "";
    }
    </script>


    well, the problem is it is not working (the text is allways hides). what do i done wrong? are there is another (working) way to do it?

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Try using 'none' as "" is not a valid value.
    Code:
    <script language="javascript">
    function show ()
    {
       document.getElementById('text').style.display = 'none';
    }
    </script>
    Its DHTML, by the way
    Regards.

  3. #3
    Join Date
    May 2003
    Posts
    37
    and what should i use for showing the DIV?

  4. #4
    Join Date
    Sep 2004
    Location
    Northeast, FL
    Posts
    332
    I think buntine had the right idea with 'none'. If it were me though, I wouldn't use javascript. I would do something like this.

    <%@ Page Language="VB" %>
    <html>
    <head>
    <script language="vb" runat="server">
    if text.visible = false then
    text.visible = true
    else
    text.visible = false
    end if
    </script>
    </head>
    <body>
    <div id="text" runat="server">some text</div>
    </body>
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles