|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionIf you want to hide and show an element or It is easy to do this using JavaScript. If you want to display personal information for each person in the list (it may be a <DIV ID="PersonalInfo1" style="display:none">
<table>
<tr><td>Street</td><td>123 sr</td></tr>
<tr><td>City</td><td>LA</td></tr>
<tr><td>State</td><td>CA</td></tr>
</table>
</DIV>
Now you need to connect this <A href="#" onclick="show('PersonalInfo1')">Senthil</A>
or: <input type="radio" value="senthil" onclick="show('PersonalInfo1')">senthil
or: <SELECT name="select1" onchange="show(this.value)">
<option value=""></option>
<option value="PersonalInfo1">senthil</option>
</select>
or: <input type="button" onclick="show('PersonalInfo1')" value="personalInfo">
By default, function show(ele) {
var srcElement = document.getElementById(ele);
if(srcElement != null) {
if(srcElement.style.display == "block") {
srcElement.style.display= 'none';
}
else {
srcElement.style.display='block';
}
return false;
}
}
When you click on the hyperlink, the browser will show the table. If you click again, the browser will hide it. Another way is that you can have a common detail area. Then when the user clicks a link or button or selects an item from the drop down, you can display details in the target. <DIV ID= "PersonalInfo"></DIV>
<A href="#" onclick="show('PersonalInfo1','
<table><tr><td>Street</td><td>123 sr</td></tr></table>
')">Senthil</A>
<A href="#" onclick="show('PersonalInfo','
<table><tr><td>Street</td><td>123 sr</td></tr></table>
')">Raj</A>
function show(ele,content) {
var srcElement = document.getElementById(ele);
if(srcElement != null) {
srcElement.innerHTML=content;
}
}
The above code will replace the inner HTML of the <DIV ID= "PersonalInfo"></DIV>
<A href="#" onclick="show('PersonalInfo','PersonalInfo1')">senthil</A>
<DIV id="PersonalInfo1" style="display:none"><table>
<tr><td>Street</td><td>123 sr</td></tr>
<tr><td>City</td><td>LA</td></tr>
<tr><td>State</td><td>CA</td></tr>
</table>
')">
function show(targetElement,contentElement) {
var tarElement = document.getElementById(targetElement);
var srcElement = document.getElementById(contentElement);
if(tarElement != null && srcElement != null) {
tarElement.innerHTML=srcElement.innerHTML;
}
}
In the above code, we define different
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||