hi,
How can i count number of combobox in my html page.
thanx
Manoj
8 18886
hi,
How can i count number of combobox in my html page.
thanx
Manoj
Try this code. -
alert(document.getElementByTagNames('select').length);
-
//It ll show the total number of combo boxes.
-
Best of luck.
Kind regards,
Dmjpro.
Try this code. -
alert(document.getElementByTagNames('select').length);
-
//It ll show the total number of combo boxes.
-
Best of luck.
Kind regards,
Dmjpro.
hi dmjpro,
i tried this solution but it is notworking. -
-
<html>
-
<head>
-
<title>Customer Inquiry</title>
-
<SCRIPT language="JavaScript1.2">
-
-
-
function CLcount()
-
{
-
alert(document.getElementByTagNames('select').length);
-
-
}
-
-
</SCRIPT>
-
</head>
-
<body>
-
-
<form name="sysaccess" >
-
-
-
-
<select name="select1" >
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
-
<select name="select2">
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
<select name="select2">
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
<input type="button" onclick="CLcount()">
-
-
-
-
-
</form>
-
-
</body>
-
</html>
-
hi dmjpro,
i tried this solution but it is notworking. -
-
<html>
-
<head>
-
<title>Customer Inquiry</title>
-
<SCRIPT language="JavaScript1.2">
-
-
-
function CLcount()
-
{
-
alert(document.getElementByTagNames('select').length);
-
-
}
-
-
</SCRIPT>
-
</head>
-
<body>
-
-
<form name="sysaccess" >
-
-
-
-
<select name="select1" >
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
-
<select name="select2">
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
<select name="select2">
-
<option value="CL">CL</option>
-
<option value="EL">EL</option>
-
</select>
-
-
<input type="button" onclick="CLcount()">
-
-
-
-
-
</form>
-
-
</body>
-
</html>
-
Did u add space in length?
Check it out and try it again without space.
Best of luck.
Kind regards,
Dmjpro.
Did u add space in length?
Check it out and try it again without space.
Best of luck.
Kind regards,
Dmjpro.
hi,
No i didn't after posting it is showing this
manoj
hi,
Its working fine.
thanx
Manoj
hi,
I want to find out how many select option has value Cl select.Can we do this?
thanx
Manoj
acoder 16,027
Recognized Expert Moderator MVP
I want to find out how many select option has value Cl select.Can we do this?
Loop through the select elements on the page (which you already have) and check the values. Just .value is usually enough.
iam_clint 1,208
Recognized Expert Top Contributor
wait wait wait...
look at what you guys put... get Element By Tag Names -
alert(document.getElementByTagNames('select').length);
-
where it should be... get Elements By Tag Name -
alert(document.getElementsByTagName('select').length);
-
-
function CLcheck() {
-
var total = 0;
-
var sels = document.getElementsByTagName('select');
-
for (i=0; i<sels.length; i++) {
-
var opts = sels[i].options;
-
for (c=0; c<opts.length; c++) {
-
if (opts[c].value == "CL") { total += 1; }
-
}
-
}
-
alert(total + " Combo boxes had the value CL in its options");
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nicolae Fieraru |
last post by:
Hi All,
I am trying to change the rowsource of a combobox when I click on it. I
played with many events, associated with the form and the combobox, but
still haven't figured out what is the way of doing it.
I have a table with products, tblProducts, some of them are Active while
others are Inactive.
The form shows all the products purchased by a customer, both Active and
Inactive in a ComboBox, cbProducts.
My client wants to view all...
|
by: Zlatko Matiæ |
last post by:
There is a form (single form) and a combobox. I want that current record of
the form is adjusted according to selected value in the combobox. Cuurrent
record should be the same as the value in the combobox.
What is the solution?
Thank you in advance.
|
by: anonymous |
last post by:
I've been trying to put a them, please help me out.
Here's the major parts of my code:
public Form1()
{
DataSet myDataSet = new DataSet("myDataSet");
DataTable testTable = new DataTable("table");
testTable.Columns.Add("Col1", typeof(Int32));
testTable.Columns.Add("Col2", typeof(String));
testTable.Rows.Add(testTable.NewRow());
|
by: TT (Tom Tempelaere) |
last post by:
Hay there,
I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one
(I hope .NET 2.0 supplies one). I based it on this article:
http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx
I have a problem when there are two DataGrid's on one form, and when I
switch focus from one grid to the other. To be more precise, when I'm editing
a combo box column in one grid, and then click in the combo column of...
|
by: Steve Wilkinson |
last post by:
Is there any method I can use to determine the number of subscribers to a
controls events.
In particular I'm looking at the ComboBox.SelectedIndexChanged event, I have
a scenario where I need to cancel the SelectedIndexChanged event and restore
the original SelectedIndex property. To do this I unsubscribe the
SelectedIndexChanged event, update the SelectedIndex property and then
re-subscribe. I need to do this to prevent the...
| |
by: SKarnis |
last post by:
We are trying to rebuild a current Access 2002 (XP) mdb program to VB.NET
with a SQL database - we are having problems with a suitable combobox.
There are many threads discussing multiple column comboboxes in .NET. We
are having success with the multiple columns similar to the combobox from
Access 2002 (XP).
Our biggest problem is speed. In a form in Access 2002, our combobox is
able to load data in a table in separate Access database...
|
by: Simon Verona |
last post by:
I posted this in dotnet.languages.vb.controls but thought I'd post here as
well..
I have a combobox that is bound to a dataview generated from a dataset.
The dataset has a single table (called "Data") with two columns "Id" and
"Description". Id contains a code and description contains the
description that is displayed in the combobox.
|
by: dbuchanan |
last post by:
VS2005
I've been reading all the help I can on the topic (MSDN, other) but I
can't make sense of this.
Desired behavior;
The user is to choose from the displayed list of the databound combobox
and the coresponding 'Id' from the lookup table is to be inserted into
the field of the new record.
I have two simple tables. "tblPerson" is the data table. The lookup
|
by: aaronfude |
last post by:
Hi,
Please consider the following class (it's not really my class, but it's
a good example for my question):
class Vector {
int myN;
double *myX;
Vector(int n) : myN(n), myX(new double) { }
double &operator()(int i) { return myX; }
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |