473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

show and hide

I got the javascript show() to work on <tdbut not on <tr>, once
I moved the <divoutside the <tr>, it stop working. What am I
missing? How would one fix this? Below is what I got. Thanks in
advance.

===========

<head>
<script type="text/javascript">
<!--
function show(id, checkbox) {
var visible = (checkbox.checked) ? "block" : "none";
document.getElementById(id).style.display = visible;
}

//-->
</script>
</head>

<table>
<tr>
<td></td>
<td>
<input name="car" value="T" type="checkbox"
onclick="show('div1', this)"Car
</td>
</tr>
<div id="div1">
<tr>
<td>Make:
</td>
<td><input id="make" size="20"></td>
</tr>
<tr>
<td>Model:
</td>
<td><input id="model" size="20"></td>
</tr>
</div>
</table>
Sep 10 '08 #1
1 1095
SAM
st***********@gmail.com a écrit :
I got the javascript show() to work on <tdbut not on <tr>, once
I moved the <divoutside the <tr>, it stop working. What am I
missing? How would one fix this? Below is what I got. Thanks in
advance.
Nor TDs or TRs are "blocks"

foo.style.display = (foo.style.display=='')? 'none' : '';

Youre toggle cant work because you cant cut a table
(to insert some of its rows in a div, for instance)
===========

<head>
<script type="text/javascript">
function show(id, checkbox) {
var visible = (checkbox.checked)? "" : "none";
document.getElementById(id).style.display = visible;
}
</script>
</head>
<form>
<table>
<tr>
<td>
<input name="car" value="T" type="checkbox"
onclick="show('div1', this)"Car
</td>
</tr>
<tr>
<td>
<table id="div1" style="display:none">
<tr>
<td>Make:</td>
<td><input id="make" size="20"></td>
</tr>
<tr>
<td>Model:</td>
<td><input id="model" size="20"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
Sep 10 '08 #2

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

Similar topics

2
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...
5
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...
10
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...
3
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...
0
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...
4
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...
7
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...
5
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...
1
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. ...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.