Activity Stream
48,167 MEMBERS
62141 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 10 of 10
  1.     
    #1
    Member
    Website's:
    mkspot.org

    Default Show/Hide div

    Hello,
    i working on school project. So i need to create table for stuff. Also when you click on the name or need to show additional div for info about prof.
    here is table
    when you click on Profesor4 info will show in profesor1

    is need to show info in clicked profesor4 no profesor 1 here is code, css and javascript

    Code: 
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            
            <script language="JavaScript">
                function toggle(id) {
                    var state = document.getElementById(id).style.display;
                    if (state == 'block') {
                        document.getElementById(id).style.display = 'none';
                    } else {
                        document.getElementById(id).style.display = 'block';
                    }
                }
            </script>
    
            
    
            <style>
    
                .tbody{
                    border-collapse: collapse;
                    width: 500px;
                    word-spacing: 2px;
                    /**position:  center; */
                    font-family:  sans-serif;
                    font-size: 18px;
                    text-align: center;
                }
                .td{
                    border-style:  double;
                    border-width: 1px;
                    padding: 2px 2px 2px 2px ;
    
                }
                
                .subject{
                    border-width: 1px;
                    border-style: double;
                }
    
    
                #main{
                    width:500px;
                    height: 20px;
                    background: lightblue;
                }
                #hidden {
                    width: auto;
                    height:20px;
                    background: aliceblue;
                    display: none;
                }
                #img{
                    /**padding-left: 10px;
                    
                    padding-right: 5px;
                    padding-left: 5px;
                    **/
                    float: right;
                }
            </style>
    
            <title>Probna tabela</title>
        </head>
        <body>
            <table class="tbody" >
                <tbody>
                    <tr>
                        <td class="td">pROFESOR</td>
                        <td class="td">Subject</td>
                    </tr>
    
                    <tr>
                        <td class="td">Profesor1<a href="#" onclick="toggle('hidden');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden">Info about prof.1</div></td>
                        <td class="subject" rowspan="4">Македонски Јазик</td>
                    </tr>
                    <tr><td class="td">Profesor2<a href="#" onclick="toggle('hidden');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden">Info about prof.2</div></td></tr>
                    <tr><td class="td">profesor3<a href="#" onclick="toggle('hidden');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden">Info about prof.3</div></td></tr>
                    <tr><td class="td">Profesor4<a href="#" onclick="toggle('hidden');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden">Info about prof.4</div>
                        </td></tr>
    </table>
    NightLightW Reviewed by NightLightW on . Show/Hide div Hello, i working on school project. So i need to create table for stuff. Also when you click on the name or http://i.imgur.com/Xof8h.png need to show additional div for info about prof. here is table http://i.imgur.com/46tJw.jpg when you click on Profesor4 info will show in profesor1 http://i.imgur.com/LDxSN.jpg is need to show info in clicked profesor4 no profesor 1 here is code, css and javascript <!DOCTYPE html> <html> Rating: 5


  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    wscripts.net damnlolscript.com lulzjet.com
    in toggle('hidden') function you must set the id. The id must be unique on the page, you have the id "hidden" for all divs.
    Try this:
    Code: 
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            
            <script language="JavaScript">
                function toggle(id) {
                    var state = document.getElementById(id).style.display;
                    if (state == 'block') {
                        document.getElementById(id).style.display = 'none';
                    } else {
                        document.getElementById(id).style.display = 'block';
                    }
                }
            </script>
    
            
    
            <style>
    
                .tbody{
                    border-collapse: collapse;
                    width: 500px;
                    word-spacing: 2px;
                    /**position:  center; */
                    font-family:  sans-serif;
                    font-size: 18px;
                    text-align: center;
                }
                .td{
                    border-style:  double;
                    border-width: 1px;
                    padding: 2px 2px 2px 2px ;
    
                }
                
                .subject{
                    border-width: 1px;
                    border-style: double;
                }
    
    
                #main{
                    width:500px;
                    height: 20px;
                    background: lightblue;
                }
                #hidden {
                    width: auto;
                    height:20px;
                    background: aliceblue;
                    display: none;
                }
                #img{
                    /**padding-left: 10px;
                    
                    padding-right: 5px;
                    padding-left: 5px;
                    **/
                    float: right;
                }
            </style>
    
            <title>Probna tabela</title>
        </head>
        <body>
            <table class="tbody" >
                <tbody>
                    <tr>
                        <td class="td">pROFESOR</td>
                        <td class="td">Subject</td>
                    </tr>
    
                    <tr>
                        <td class="td">Profesor1<a href="#" onclick="toggle('hidden1');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden1">Info about prof.1</div></td>
                        <td class="subject" rowspan="4">Македонски Јазик</td>
                    </tr>
                    <tr><td class="td">Profesor2<a href="#" onclick="toggle('hidden2');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden2">Info about prof.2</div></td></tr>
                    <tr><td class="td">profesor3<a href="#" onclick="toggle('hidden3');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden3">Info about prof.3</div></td></tr>
                    <tr><td class="td">Profesor4<a href="#" onclick="toggle('hidden4');"><img id="img" src="http://127.0.0.1/kadar/plus.png"/></a>
                            <div id="hidden4">Info about prof.4</div>
                        </td></tr>
    </table>

  4.     
    #3
    Member
    Website's:
    mkspot.org
    okay now thanks very much. But the info is displayed immediately, I want to show info when clicked the professor or the image



    or how can i do this on click to show info like this? Can you give some ex. code for this
    this is web
    Code: 
    http://nova.edu.mk/EN/learning_at_nova/high_school/faculty_and_staff.aspx


  5.     
    #4
    Respected Member
    Just right click that page and view source to see how it is done.

  6.     
    #5
    Member
    Website's:
    mkspot.org
    I try this to view code of page but i don't have success. I don't understand JavaScript also try on local host but nothing. If anyone know how to do this i will pay for that


  7.     
    #6
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    To achieve a similar effect, you could use jquery UI dialog: http://jqueryui.com/demos/dialog

  8.     
    #7
    Member
    Website's:
    mkspot.org
    This dialog is for showing info about one thing. I need for more then 20 person info to show in different dialog box on click.
    ex.

    If i click on Professor 1 to show info about Professor1
    if i click on Professor 2 to show info about Professor2.....
    is something like this on picture

    you can see i click on Anglea and i can view info about Anglea if i click on Aleksandar i can see info about him

    Thanks to all who helped me and want to help


  9.     
    #8
    Member
    Website's:
    vpsvolt.com
    Just right click the page. Save page as and then open it as a new site in Dreamweaver or your preferred code editing software and work the code down until all you are left with is the JS files and the code for the popout.

    Thanks, VPSVolt.

  10.     
    #9
    Member
    Website's:
    mkspot.org
    @VPSVolt- thanks i will try with this solution And can i combine JS files in one JS file?
    I always edit code in NetBeans.


  11.     
    #10
    Member
    Website's:
    mjcoder.co.uk mjcoder.posterous.com
    im sure there are quite few jQuery plugins for this sort of thing. Have a look around.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Vbulletin] Hide links in 1 forum and show in another..??
    By downloadsmasti in forum vBulletin
    Replies: 2
    Last Post: 30th May 2011, 09:31 AM
  2. Replies: 9
    Last Post: 20th Jan 2011, 11:59 PM
  3. Hide / show remote file extension
    By CatchItBaby in forum Technical Help Desk Support
    Replies: 1
    Last Post: 9th Dec 2010, 07:51 PM
  4. How can I put option to show/hide Porn Section
    By thatswhatshesaid in forum vBulletin
    Replies: 4
    Last Post: 10th Oct 2010, 04:12 AM
  5. show or hide javascript/jquery
    By shadow.prx in forum Technical Help Desk Support
    Replies: 0
    Last Post: 14th Nov 2009, 02:59 AM

Tags for this Thread

BE SOCIAL