473,796 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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.pro duct}";
var doc = document.forms[0]['customer.produ ct'];

if (doc){
for(var i=0;i<doc.optio ns.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.h tml" enctype="applic ation/x-www-form-urlencoded">
<table>
<tr>
<td colspan="2" class="selectLa nguage center">
<select id="customer.pr oduct" name="customer. product" class="small inline">
<option value="">Select </option>
<option value="8a848801 0f82a1e6010f82a 3ca320093">Span ish</option>
<option value="8a848801 0f82a1e6010f82a 3ca70009d">Fren ch</option>
<option value="8a848801 0f82a1e6010f82a 3ca9f00ad">Ital ian</option>
<option value="8a848801 0f82a1e6010f82a 3ca8000a5">Germ an</option>
</select>
<span class="error">S elect Language</span>
</td>
</tr>
<tr>
<td colspan="2">
<label for="customer.f irstName">First Name:</label>
<input id="customer.fi rstName" name="customer. firstName" type="text" class="large" />
</td>
</tr>
<tr>
<td colspan="2">
<label for="customer.l astName">Last Name:</label>
<input id="customer.la stName" 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.getEle mentsByTagName( 'div');
for(var i=0; i<tagName.lengt h; i++){
tagName[i].className = 'CLASS HERE';
if(tagName[i].className.styl e.display == 'none') {
tagName[i].className.styl e.display = 'block';
}
else {
tagName[i].className.styl e.display = 'none';
}
}
}
//return false;
//}

self.switchCont ent = function() {
var product = "${customer.pro duct?url}"
if(product == "8a8488010f82a1 e6010f82a3ca320 093") //Spanish
{
setss('spanish' )
}else if(product == "8a8488010f82a1 e6010f82a3ca700 09d") //French
{
setss('french')
}
else if(product == "8a8488010f82a1 e6010f82a3ca9f0 0ad") //Italian
{
setss('italian' )
}
else if(product == "8a8488010f82a1 e6010f82a3ca800 0a5") //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 2240
acoder
16,027 Recognized Expert Moderator MVP
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
3514
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 buttons to hide all rows with a particular status. The code to show/hide is relatively easy, but how do I turn them all off at once? Several ideas I had:
19
6934
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 JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
4
2237
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 <div class="hide"> <tr> <td nowrap>Name:</td> <td nowrap>Monty</td>
9
2031
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 HTMLID.Style = "10px"; however I need to apply it to a CSS class not a single ID. What is the code for that?
1
4955
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: http://munich.schwarz-interactive.de/autocomplete.aspx
4
2438
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 & ClassName (ClassID being the primary key) The TeacherClass table has 3 columns - TCID (AutoNumber), TeacherID & ClassID. One teacher can teach multiple classes & one class can be taught by multiple teachers. The TeacherClass table basically...
3
1956
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 displayed (I put a max limitation of 500 lines). Ex. list of cars Fiat to buy in UK. A clic on a line will bring me to the display page disp.php Ex. I will clic on the car n° 5 =<a href="disp.php?
9
2077
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/ **user**/public_html/uploads to prevent any old user from browsing them. I then use a general showDoc page with the following function (from
10
7422
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 field display not display degree text field ->when user select other value in the selection field for degree then text field display and wise versa //// <bodly> <table>
0
9673
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
10449
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...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
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...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
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
4114
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
3
2924
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.