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

Build a 3 x 3 table using colour selected from a list box

can someone tell me how to do this?

Write a program that uses a list box to display different colours. Then, depending on what colour is selected in the list, it will build a 3 X 3 table using that colour
Aug 30 '07 #1
5 1299
Logician
210 100+
can someone tell me how to do this?

Write a program that uses a list box to display different colours. Then, depending on what colour is selected in the list, it will build a 3 X 3 table using that colour
Yes - but you wouldn't learn anything, which I suspect was the purpose of a summer holiday assignment, due next week.
Aug 30 '07 #2
true, ok how bout this.... simple script, won't work.

i'm just trying to get an alert when the second item is selected

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript1.2">
  2.  
  3.     function change()
  4.  
  5.     if (document.form1.namesLst.options[1].selected)
  6.     {
  7.     alert("The first option is selected");
  8.     }
  9.  
  10.  
  11.     </script>

and the html

[HTML] <form name="form1">
<select name="namesLst" onChange="change()">
<option value="item1">Kyle</option>
<option value="item2">George</option>
<option value="item3">Ali</option>
</select>
</form>
[/HTML]



should an alert not be triggered when i choose "Kyle"?
Aug 30 '07 #3
gits
5,390 Expert Mod 4TB
nope ... you have to CHANGE the selection first and than choose kyle again ;) the event is called onchange ... ;) and kyle is option[0] of course ...

so the code for your example must be adapted - and note the correct function-definition (the functionbody must be wrapped with curly brackets):

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     function change() {
  3.         if (document.form1.namesLst.options[0].selected) {
  4.             alert("The first option is selected");
  5.         }
  6.     }
  7. </script>
[HTML]<form name="form1">
<select name="namesLst" onChange="change()">
<option value="item1">Kyle</option>
<option value="item2">George</option>
<option value="item3">Ali</option>
</select>
</form>[/HTML]

kind regards
Aug 30 '07 #4
thanks gits!

right, now i have to have a number of colours in the list, and when you select one, it draws a table, and colours it in.......

will give it a bash, but no doubt i'll be back.
Aug 30 '07 #5
acoder
16,027 Expert Mod 8TB
Changed the thread title. Please use a good thread title.
Aug 30 '07 #6

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

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
5
by: Ian Sykes | last post by:
I'm writing a web application which has the following requirements for the presentation of tabular data in HTML to users: * Columns and rows can be re-sized by dragging the mouse * Internal...
1
by: dschectman | last post by:
I have an interesting issue. I need to implement a dynamic table to mimic a select list. Each time you double click from the master list, a row is added to the list of selected items. The list...
4
by: Martin Eyles | last post by:
Hi! I am trying to make several 1x3 tables on a webpage, where all three cells have black backgrounds and white text. However, I want the space around each of the cells, and the whole box to be...
76
MMcCarthy
by: MMcCarthy | last post by:
Normalisation is the term used to describe how you break a file down into tables to create a database. There are 3 or 4 major steps involved known as 1NF (First Normal Form), 2NF (Second Normal...
2
by: teddymeu | last post by:
Hi Guys, this is kinda complicated but ill do my best to explain. I have two tables. products and categories. Products holds product info and an image, its primary key is ProductID. Category table...
1
by: JSievers | last post by:
Hallo. A good friend of me develops web suites, for example his own at: www.augenpunkte.de. As you can see there my friend is blind and also he uses a Braille-line to develop these projects. For...
3
by: N L | last post by:
Greetings, I want to create a form in Access that shows a list of checkboxes to a user. The checkboxes will be dynamically generated, showing the fields in a table the user has selected in a...
3
Frinavale
by: Frinavale | last post by:
Hi there, I'm using JavaScript to highlight a row or column in a table. I have created a CSS class that changes the background colour to a light blue and I apply this class to the cells in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.