Jump to content

Expand/Collapse script issue


Recommended Posts

I've been trying to learn how to show and hide a block of text on a webpage.

I know this may seem like a similar post on this topic but what I'm looking to do is emulate what I found on a Microsoft MSDN site.


I want to learn how to click on an anchor/link and change the image from [+] to [-].


I can hide the text but swaping the image doesn't work. Just get no image at all.


Here's the link to page that I'm referring to. Just scroll down a bit on the right frame and you'll find the "[-]Expand All" link:



I usually try to view source to learn how something works but MS sites have too much code behind the scenes.


If you know of a link that has something like this then just reply with that. I just wanted to learn how to do it.




Link to comment
Share on other sites

See the ASPX at the end of the URL? They are doing that with ASP controls built into the .NET framework. Really easy when you are using that.


I don't use JS, so I will leave it to others.


But let me say, make sure the default position of the links is rolled out and the JS hides them. A lot of user agents do not support JS, So the nav is hidden from them. If the nav is open and hidden with JS, if JS is not there... they can still use the site. Far to many open it with JS and lock such users out.

Link to comment
Share on other sites

x Disclaimer

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut erat felis, euismod quis, blandit eget, pulvinar a, ante. Maecenas ac ante in dolor malesuada malesuada. Sed enim nunc, sollicitudin ac, pellentesque ac, blandit id, nulla. Sed interdum feugiat sem. Pellentesque semper vehicula dui. Phasellus vitae massa eu odio ornare consectetur. Curabitur vulputate, elit eu iaculis imperdiet, augue nibh imperdiet erat, tincidunt fermentum lectus arcu accumsan nibh. Nunc a massa. Duis est orci, pulvinar vitae, porta tincidunt, cursus et, neque. Proin tellus erat, dignissim ac, facilisis in, gravida at, est. Aliquam erat volutpat. Phasellus ultrices justo at sapien accumsan pellentesque. Praesent at enim.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...