473,387 Members | 1,515 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/Hide table row

Aly
I am building a site that sells 3 standard packages and one custom package.
On the package selection page, I want the following:

Upon loading the page, I want the package selections (Basic, Standard,
Advanced, and Custom) to be visible, as well as an Email field and Payment
Method field.

I want nothing to happen when Basic, Standard, or Advanced are clicked. When
Custom is clicked (radio buttons for all), I want the custom options to
appear. If Basic, Standard, or Advanced are chosen again, I want the custom
options to disappear.

I have found a few different codes, but none of them do exactly what I am
looking for. I have seen it done, and tried to copy the code, but it didn't
work. I'm assuming there was something in a .js file that affected it.

If anyone could help, I would be greatly appreciative.

Aly
Jan 17 '06 #1
4 5385
Aly
Following up on myself...

I have found one script that almost does what I want. However, I'm unsure
how to make it work for more than 2 options. Here is the basic page html
including the script so that someone may be able to help me.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="JavaScript" type="text/JavaScript">
function ref(object)
{
if (document.getElementById)
{
return document.getElementById(object);
}
else if (document.all)
{
return eval('document.all.' + object);
}
else
{
return false;
}
}

function expand(object)
{
var object = ref(object);

if( !object.style )
{
return false;
}
else
{
object.style.display = '';
}

if (window.event)
{
window.event.cancelBubble = true;
}
}

function contract(object)
{
var object = ref(object);

if( !object.style )
{
return false;
}
else
{
object.style.display = 'none';
}

if (window.event)
{
window.event.cancelBubble = true;
}
}

function toggle(object)
{
object = ref(object);
if( !object.style )
{
return false;
}

if( object.style.display == 'none' )
{
object.style.display = '';
}
else
{
object.style.display = 'none';
}
}
</script>

</head>

<body>
<table width="100%" border="1" cellpadding="5" cellspacing="0"
bordercolor="#000000">
<tr>
<td bgcolor="#CCCCCC">
Hide Extra Content
<select name="select" onchange="toggle('morestuff'); return false;">
<option value="Yes" selected>Yes</option>
<option value="No">No</option>
</select></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">Here is some content that shows. </td>
</tr>
<tbody id="morestuff" style="display: none">
<tr>
<td bgcolor="#33FF00"><p>This is hidden content</p>
</td>
</tr>
<tr>
<td bgcolor="#FFFF00">This is hidden content </td>
</tr>
<tr>
<td bgcolor="#FF66CC">This is hidden content </td>
</tr>
</tbody>
<tr>
<td bgcolor="#CCCCCC">Here is more content that shows. </td>
</tr>
</table>
</body>
</html>
Jan 17 '06 #2
On 2006-01-17, Aly <al********@shaw.ca> wrote:
I have found a few different codes, but none of them do exactly what I am
looking for. I have seen it done, and tried to copy the code, but it didn't
work. I'm assuming there was something in a .js file that affected it.


more likely there was something wrong with the HTML

Bye.
Jasen
Jan 19 '06 #3
On 17/01/2006 18:45, Aly wrote:

[snip]
Upon loading the page, I want the package selections (Basic, Standard,
Advanced, and Custom) to be visible, as well as an Email field and Payment
Method field.

I want nothing to happen when Basic, Standard, or Advanced are clicked. When
Custom is clicked (radio buttons for all), I want the custom options to
appear. If Basic, Standard, or Advanced are chosen again, I want the custom
options to disappear.


Could you please post a link to the document as it stands now. It would
be much easier to describe a solution if we can see precisely what
markup will be involved (especially if changes to that markup are
necessary).

[snip]

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Jan 19 '06 #4
Aly

"Michael Winter" <m.******@blueyonder.co.uk> wrote in message
Could you please post a link to the document as it stands now. It would be
much easier to describe a solution if we can see precisely what markup
will be involved (especially if changes to that markup are necessary).


Actually, it's not necessary :) I managed to figure it out on my own, and it
now works marvelously :) Thanks, though!

Aly
Jan 19 '06 #5

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

Similar topics

18
by: Michael Skind | last post by:
Hello, I use a simple Table : <TABLE> <TR 1> <TD></TD> </TR> <TR 2> <TD></TD> </TR>
7
by: Mad Scientist Jr | last post by:
Through messing around I got IE6 (win xp) to show/hide a table row. I gave my <TR> an ID of "trRow" and trRow.style.display='none'; hides it trRow.style.display='block'; displays it (will any...
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...
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
11
by: jimstruckster | last post by:
I have a table with 10 rows, I want all rows except for the first to be hidden when the page first opens up. If the user puts a value in a text box in the first row then I want the second row to...
6
by: michael941 | last post by:
Hi, I have 2 tables in an html page. I have div them separately and id them as id1 and id2. I have a link there. What I need is click the link to hide one table and show the other and verse when...
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. ...
18
by: Liquidtouch | last post by:
I have been searching on this for awhile and cant find anything and playing around with it got me no where. I will start with what I am after and then explain what I have. I have a table with 3...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.