473,788 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Show/hide TR

Hi There,

I would like to show details in another (hidden) TR. It should look like
something like on an image I have found wich illustrates it exactly is I
want:

http://otn.oracle.com/tech/blaf/spec...ils_white1.gif

Is there a sample code to do this? I allready could change the status from a
hidden tr using:

function toggle(theElem) {
document.getEle mentById(theEle m).style.displa y =
(document.getEl ementById(theEl em).style.displ ay == 'none')?'':'non e';
}

But I would like a (sample)code, which changes the + and - and the Hide/Show
text. Any help appreciated.
Jul 20 '05 #1
1 12641
"Roger Godefroy" <godefroy@(no spam)home.nl> wrote in message
news:bk******** **@news3.tilbu1 .nb.home.nl...
Hi There,

I would like to show details in another (hidden) TR. It should look like
something like on an image I have found wich illustrates it exactly is I
want:

http://otn.oracle.com/tech/blaf/spec...ils_white1.gif
Is there a sample code to do this?


Well, tested on IE6 and Mozilla, this should works:

<html>
<head>
<script type="text/javascript">
function appendRow(after ){
var newrow = document.create Element("TR");
var newcell = newrow.appendCh ild(document.cr eateElement("TD "));
newcell.setAttr ibute("colSpan" , "7");
newcell.innerHT ML = "WHATEVER YOU WANT";
try{
after.parentNod e.insertBefore( newrow,after.ne xtSibling);
}
catch(e){
after.parentNod e.appendChild(n ewrow);
}
}
function removeRow(thisR ow){
thisRow.parentN ode.removeChild (thisRow.nextSi bling,true);
}
function toogle(evt){
var evt = evt || window.event;
var obj = evt.target || evt.srcElement;
if (!obj.expanded) {
obj.firstChild. nodeValue = "Hide";
appendRow(obj.p arentNode);
}
else{
obj.firstChild. nodeValue = "Show";
removeRow(obj.p arentNode);
}
obj.expanded = !obj.expanded;
}

function init(){
var tds = document.getEle mentsByTagName( "TD");
for (var i=0; i<tds.length; i++){
if (tds[i].className == "sh"){
tds[i].expanded = false;
if (tds[i].addEventListen er)
tds[i].addEventListen er("click",toog le,false)
else if (tds[i].attachEvent)
tds[i].attachEvent("o nclick",toogle) ;
else tds[i].onclick = toogle;
}
}
}
onload=init;
</script>
<style type="text/css">
..sh{
color:blue;
cursor:pointer;
text-decoration:unde rline;
}
</style>
</head>

<body>
<table border=1>
<thead>
<tr>
<th>Details</th>
<th>Line</th>
<th>Item Description</th>
<th>Unit</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6" align="right">T otal</td>
<td>1,200.00</td>
</tr>
</tfoot>
<tbody>
<tr>
<td class="sh">Show </td>
<td>1</td>
<td>Some description</td>
<td>134</td>
<td>76</td>
<td>100</td>
<td>300</td>
</tr>
<tr>
<td class="sh">Show </td>
<td>2</td>
<td>Some description</td>
<td>12</td>
<td>765</td>
<td>100</td>
<td>300</td>
</tr>
<tr>
<td class="sh">Show </td>
<td>3</td>
<td>Some description</td>
<td>32</td>
<td>43</td>
<td>100</td>
<td>300</td>
</tr>
<tr>
<td class="sh">Show </td>
<td>4</td>
<td>Some description</td>
<td>34</td>
<td>76</td>
<td>100</td>
<td>300</td>
</tr>
</tbody>
</table>
</body>
</html>

HTH,

Vjekoslav
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2510
by: Ajai Kumar .R | last post by:
Hai all, I've two or more forms on my app. My requirement is, Have to show the first form asa the user press a button have to hide the first form and show the second form. If the user press the escape key on second form, this should be hidded and should show the first form.... Can some one guide me how to achive this... (MUST USE SHOW & HIDE FORM PROPERTIES). I tried to achive this using the below code but when i check the Windows->Task...
5
4513
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main functions I have 2 sub functions under each("Add Job", "View Jobs" and "Add User", "View Users"). I have theses subfunctions grouped in a TabControl, so there are 2 TabControl objects on my main screen, each with 2 pages on. When the user...
10
4660
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide with the javascript in a toggle fashion. the problem is a know very little javascript and have become incredibly frustrated because i went ahead thinking it was going to be like C. its not. I know i can use these lines to do the actual work:
3
2954
by: alex | last post by:
I'd like to have a show/hide widget on my web site, kind of like "show details" / "hide details" in Google Groups. Is there a tutorial explaining how to make them? Google's is a bit complex and it's easy to get something wrong. If the browser does not support the required features, I want it to generate a completely static page with the "details" shown automatically.
0
2101
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display some stuff in the main display area. The stuff to display is one of many assemblies loaded at the opening of the application by Activator.CreateInstance, because I want it independant of the main application, as a plugin. All assembly are loaded...
4
4232
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however I would really like to use linked images instead to do the following: - When open.gif is clicked, the contents of the div show and open.gif is swapped with close.gif - subsequently, when close.gif is clicked, the div contents get hidden
7
29155
by: FP | last post by:
I'm new to Java Script. I'm displaying comments people have made. Below each persons' comment I want to add 2 buttons "Reply" and "Amend". Clicking "Reply" would display an empty text field below the comment with a spell check & submit button. Clicking "Amend" would display the same buttons & text field but pre-populated with the original comment. Using Java Script how do I show / hide the text field in my list of comments but have...
5
8440
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of form tags and div elements say n. The problem
1
4173
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. I don`t want to change the way i have used to show and hide layers. check down code :- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
3813
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown properties alt in img tag istead of picture . place of the pictures is saved in the database(my database is with mysql) and in home page i fetch properties of the product and address of place that pictures is located output of the code in the...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.