473,407 Members | 2,320 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,407 software developers and data experts.

How to display a CSS class and hide another depending on previous page selection

Hi,
I need help with this. I am trying to figure it out but I can't.

I have 2 pages. I would like to display in the second page the content of one class and hide the content of the other classes.

The idea is make the user to select a language, then display in the next page the content related to the selected option.

This is the code I got so far, but I can't make it work.
###### PAGE 1 ########
[HTML]<html>
<head>
<title></title>

<script type="text/javascript">
function setlang () {
var product = "${customer.product}";
var doc = document.forms[0]['customer.product'];

if (doc){
for(var i=0;i<doc.options.length;i++){
if (doc.options[i].value == product) doc.options[i].selected = true
}

}
}
</script>
</head>
<body onLoad="setlang();">
<form id="lang-form" method="post" action="page2.html" enctype="application/x-www-form-urlencoded">
<table>
<tr>
<td colspan="2" class="selectLanguage center">
<select id="customer.product" name="customer.product" class="small inline">
<option value="">Select</option>
<option value="8a8488010f82a1e6010f82a3ca320093">Spanish</option>
<option value="8a8488010f82a1e6010f82a3ca70009d">French</option>
<option value="8a8488010f82a1e6010f82a3ca9f00ad">Italian</option>
<option value="8a8488010f82a1e6010f82a3ca8000a5">German</option>
</select>
<span class="error">Select Language</span>
</td>
</tr>
<tr>
<td colspan="2">
<label for="customer.firstName">First Name:</label>
<input id="customer.firstName" name="customer.firstName" type="text" class="large" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="customer.lastName">Last Name:</label>
<input id="customer.lastName" name="customer.lastName" type="text" class="large" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" alt="Continue" />
</td>
</tr>
</table>
</form>
</body>
</html>[/HTML]
###### EN OF PAGE 1 ########





###### PAGE 2 ########
[HTML]<html>
<head>
<title></title>

<link type="text/css" rel="stylesheet" href="css/global.css" />
<script type="text/javascript">

function Toggle(){
var tagName = document.getElementsByTagName('div');
for(var i=0; i<tagName.length; i++){
tagName[i].className = 'CLASS HERE';
if(tagName[i].className.style.display == 'none') {
tagName[i].className.style.display = 'block';
}
else {
tagName[i].className.style.display = 'none';
}
}
}
//return false;
//}

self.switchContent = function() {
var product = "${customer.product?url}"
if(product == "8a8488010f82a1e6010f82a3ca320093") //Spanish
{
setss('spanish')
}else if(product == "8a8488010f82a1e6010f82a3ca70009d") //French
{
setss('french')
}
else if(product == "8a8488010f82a1e6010f82a3ca9f00ad") //Italian
{
setss('italian')
}
else if(product == "8a8488010f82a1e6010f82a3ca8000a5") //German
{
setss('german')
}
}
</script>
</head>
<body>
<table>
<tr>
<td colspan="2">
<h1 class="spanish">Spanish</h1>
<h1 class="french">French</h1>
<h1 class="italian">Italian</h1>
<h1 class="german">German</h1>
</td>
</tr>
</table>
</body>
</html>[/HTML]

###### EN OF PAGE 2 ########
Mar 13 '08 #1
1 2211
acoder
16,027 Expert Mod 8TB
You can't post to an HTML page. If you use the GET method, you can retrieve the value from the URL.
Mar 14 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RIck Measham | last post by:
I have a dynamically generated table, filled from a database by a perl application. Each row represents a database record and has a 'status' and a unique 'id'. What I want to do is create...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
4
by: bissatch | last post by:
I am trying to use DIV tags and a class to hide the DIV and the HTML within. I will use JavScript to change it from hidden to visible but that will come later. Below is the code I am using ...
9
by: Will | last post by:
I have given up looking for a solution so I figured I would break down and ask. I am trying to modify a CSS class in page_load. I have no problem doing it with an ID with the simple ...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
4
by: rn5a | last post by:
A MS-Access DB has 3 tables - Teacher, Class & TeacherClass. The Teacher table has 2 columns - TeacherID & TeacherName (TeacherID being the primary key). The Class table too has 2 columns - ClassID...
3
by: phil67b | last post by:
Hello everybody, I have a page rech.php where I'm doing a multi-criteria research Ex. choose your car model, choose your country. After validation of my form, on the same page, the lines will be...
9
by: tomhawkins1 | last post by:
Hi I currently have a site where users can upload files. These files can be doc, wmv, jpeg, xls, dwf, dwf and dwg. These files are uploaded to /home/**user**/uploads and not /home/...
10
by: dkyadav80 | last post by:
<html> /// here what shoud be java script for: ->when script run then not display all input text field only display selection field. ->when user select other value for institute only this...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.