472,364 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

dynamic div

Hey,

What I'm trying to do is, based on a user selection from a drop down, dynamically show a div and it's contents. This is a short version of what I'm doing so code is missing.

I have the select with the onChange
Expand|Select|Wrap|Line Numbers
  1. <select id="program" tabindex="2" onChange="reveal(choice)" name="program">
  2.  

Then I have the div with the name
Expand|Select|Wrap|Line Numbers
  1. <div id="prerequisites_div"> </div>
  2.  
and then I have the function that handles the processing
Expand|Select|Wrap|Line Numbers
  1. function reveal(chosen)
  2. {
  3.  
  4.  
  5.     var n=1;
  6.     len = document.form1.program.length;
  7.     i = 0;
  8.     chosen = "none";
  9.  
  10.     for (i = 0; i < len; i++) 
  11.     {
  12.         if (document.form1.program[i].selected)
  13.         {
  14.  
  15.         chosen = document.form1.program[i].value
  16.  
  17.         } 
  18.     }
  19.     if (chosen == "BSN") 
  20.     {
  21.  
  22.     prerequisites_div.innerHTML = prerequisites_div.innerHTML +
  23.  
  24.     "<td align='middle' bgcolor='white' colspan='2'>....on and on to this" + n
  25.                  }
  26.                  else
  27.                  {
  28.                      return false;
  29.                  }
  30.  
  31. }
  32.  
Can someone help me see this through or steer in the right way to get this accomplished.
Dec 11 '07 #1
2 1089
omerbutt
638 512MB
u havent explained u problem what are u trying to d where from the prerecquisites are you showing from a database or what are the hardcoded if you are rettrieving from a database are u using xmlhttpresponse object or what the way yu have told no one is going to answere don shy tp show up ur code buddy no ones gonna cheat it[:D]
Hey,

What I'm trying to do is, based on a user selection from a drop down, dynamically show a div and it's contents. This is a short version of what I'm doing so code is missing.

I have the select with the onChange
Expand|Select|Wrap|Line Numbers
  1. <select id="program" tabindex="2" onChange="reveal(choice)" name="program">
  2.  

Then I have the div with the name
Expand|Select|Wrap|Line Numbers
  1. <div id="prerequisites_div"> </div>
  2.  
and then I have the function that handles the processing
Expand|Select|Wrap|Line Numbers
  1. function reveal(chosen)
  2. {
  3.  
  4.  
  5.     var n=1;
  6.     len = document.form1.program.length;
  7.     i = 0;
  8.     chosen = "none";
  9.  
  10.     for (i = 0; i < len; i++) 
  11.     {
  12.         if (document.form1.program[i].selected)
  13.         {
  14.  
  15.         chosen = document.form1.program[i].value
  16.  
  17.         } 
  18.     }
  19.     if (chosen == "BSN") 
  20.     {
  21.  
  22.     prerequisites_div.innerHTML = prerequisites_div.innerHTML +
  23.  
  24.     "<td align='middle' bgcolor='white' colspan='2'>....on and on to this" + n
  25.                  }
  26.                  else
  27.                  {
  28.                      return false;
  29.                  }
  30.  
  31. }
  32.  
Can someone help me see this through or steer in the right way to get this accomplished.
Dec 12 '07 #2
acoder
16,027 Expert Mod 8TB
Use document.getElementById("prerequisites_div") to access the div element.

To hide it, set the style.display property to "none". You could do this inline, e.g.
[HTML]<div id="prerequisites_div" style="display:none">...</div>[/HTML]

To display the div, set the style.display property to "block".
Dec 12 '07 #3

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

Similar topics

0
by: Roel Wuyts | last post by:
CALL FOR CONTRIBUTIONS International Workshop on Revival of Dynamic Languages http://pico.vub.ac.be/~wdmeuter/RDL04/index.html (at OOPSLA2004, Vancouver, British Columbia, Canada, October...
1
by: Guinness Mann | last post by:
When you guys talk about "dynamic SQL," to what exactly are you referring? Is dynamic SQL anything that isn't a stored procedure? Specifically, I use ASP.NET to communicate with my SQL Server...
6
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of...
3
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
7
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
5
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.