CODE (html):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
- <body>
- <script>
- function collapsElement(id) {
- if ( document.getElementById(id).style.display != "none" ) {
- document.getElementById(id).style.display = 'none';
- }
- else {
- document.getElementById(id).style.display = 'block';
- }
- }
- </script>
- <div><a href="javascript:collapsElement('id1')" style="color:green; font-size:17px;" rel="nofollow" color="red">Вопрос1</a>
- <div id="id1" style="display: none">
- Ответ1
- </div>
- </div>
- <br>
- <div><a href="javascript:collapsElement('id2')" style="color:green; font-size:17px;" rel="nofollow">Вопрос2</a>
- <div id="id2" style="display: none">
- Ответ2
- </div>
- </div>
- <br>
- <div><a href="javascript:collapsElement('id3')" style="color:green; font-size:17px;" rel="nofollow" color="red">Вопрос3</a>
- <div id="id3" style="display: none">
- <p>Ответ3</p>
- </div>
- </div>
- <br>
- </body>
- </html>