NightLightW
Active Member
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
i working on school project. So i need to create table for stuff. Also when you click on the name or
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>