473,651 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with function to determine listbox contents

Hi,

I was wondering if this is correct code for determine the contents of
a listbox. I'm particularly interested to know if the
sel1.options[i].valueOf() call will tell me the value of the item as
it loops through the for statement:

function listBoxContents (sel1)
{
var selLength1 = sel1.length;
var i;
var values;

for(i=0; i<=selLength1-1; i++)
{
values=sel1.opt ions[i].valueOf() + ",";
}
var lastComma = values.lastInde xOf(',');
values = values.substrin g(0,lastComma);

return values;
}

May 3 '07 #1
3 1375
On May 3, 7:12 am, tks...@gmail.co m wrote:
Hi,
function listBoxContents (sel1)
{
var selLength1 = sel1.length;
var i;
var values;

for(i=0; i<=selLength1-1; i++)
{
values=sel1.opt ions[i].valueOf() + ",";
}
var lastComma = values.lastInde xOf(',');
values = values.substrin g(0,lastComma);

return values;}
function listBoxContents (sel1)
{
var selLength1 = sel1.options.le ngth,i,values=' ';

for(i=0; i<selLength1; i++)
values+=sel1.op tions[i].value+ ",";
return values.slice(0,-1)
}

May 3 '07 #2
On May 3, 9:36 am, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
On May 3, 7:12 am, tks...@gmail.co m wrote:
Hi,
function listBoxContents (sel1)
{
var selLength1 = sel1.length;
var i;
var values;
for(i=0; i<=selLength1-1; i++)
{
values=sel1.opt ions[i].valueOf() + ",";
}
var lastComma = values.lastInde xOf(',');
values = values.substrin g(0,lastComma);
return values;}

function listBoxContents (sel1)
{
var selLength1 = sel1.options.le ngth,i,values=' ';

for(i=0; i<selLength1; i++)
values+=sel1.op tions[i].value+ ",";
return values.slice(0,-1)

}


Thanks! Now say I want to hide this return value in hidden input, can
I say something like below:

function listBoxContents (sel1)
{
var selLength1 = sel1.options.le ngth,i,values=' ';

for(i=0; i<selLength1; i++)
values+=sel1.op tions[i].value+ ",";
document.writel n("<input type='hidden' name='hiddenVal ues' value='"
+ values.slice(0,-1) + "'>");
}

May 3 '07 #3
tk****@gmail.co m wrote:
Thanks! Now say I want to hide this return value in hidden input, can
I say something like below:

function listBoxContents (sel1)
{
var selLength1 = sel1.options.le ngth,i,values=' ';

for(i=0; i<selLength1; i++)
values+=sel1.op tions[i].value+ ",";
document.writel n("<input type='hidden' name='hiddenVal ues' value='"
+ values.slice(0,-1) + "'>");
}
function listBoxContents (sel1)
{
var selLength1 = sel1.options.le ngth,i,values=' ';

for(i=0; i<selLength1; i++)
values+=sel1.op tions[i].value+ ",";
var input=document. createElement(" input");
input.name="hid denValues";inpu t.type="hidden" ;
input.value=val ues.slice(0,-1);
document.body.a ppendChild(inpu t);
}

May 3 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2098
by: Edward King | last post by:
....I should have mentioned that I need to call the help function from a hyperlink... but <a href="<? gethelp(1) ?>">Get Help</a> Doesnt work.... EK
1
1972
by: cloverme | last post by:
Hi, I need help populating a listbox from a database on a webform. I created a an access database with a table, fields and data. Then I created a WebForm in vb.net and added a DropDownList control to the page. Then I created a data connection to my table... I right clicked and told it to generate a dataset (which it created dataset1).
4
4736
by: dixie | last post by:
I have an extended multi-select list box of names in which the bound column is a person ID field called ID (text, not numerical). I want that list to act as a parameter in a query that is simply going to produce a medical report for each person in the list box. Now, I know this should be easy. My query for the medical report only has 4 fields, ID, Firstname, Lastname, Medical, but I cant seem to use the listbox of names to act as...
1
3295
by: JNariss | last post by:
Hello, I have created a form called frmS2P with the following: 1 listbox called List11 which holds the contents of a query created off my table called tblRequestActions. The fields which the listbox holds are Request_ID and MoveNumber. 1 text box called Date which is populated with the default value of =Date( ).
0
1184
devonknows
by: devonknows | last post by:
Hey everyone, i was wondering is there anyway that you can print the contents of a list box only, i have a large listbox that has over 300 entries inside it. so dont really want to have to make the form size that big, lol, im using vbTab to make colums inside of the listbox aswell. Any help that you can give me would be most appreciated asalways Kind regards again, devon.
1
1123
by: Myfoolishlove | last post by:
Hey everyone. I'm trying to create a small program with Visual Basic to determine the prices of tickets at a baseball game depending on where the seats are. I'm using a listbox/combo box to display the different places of sitting (such as Home plate - upper deck,home plate -lower deck, etc etc.) I am having a hard time figuring out how I can make it where once the person selects their seating category, It will determine which price the number...
12
1366
by: ross m. greenberg | last post by:
I'm trying to create a function in JavaScript using Dreamweaver8 such that when a user hits the ' F1' key when a text box is selected a separate "pop-up" window will open, with text of my choice. Does anybody have any pointers or even some source code? I use ASP on my server. Thanks! Ross
2
10093
by: webguy262 | last post by:
I'm trying to troubleshoot a membership script. The script is attempting to write to a file called .fdaccess. The function that's throwing the error is in a file called htpasswd.php. Here's the fuinction: function save($file=false){ $fcontents = ""; if($file == false) $file = $this->_path; foreach(array_keys($this->users) as $user){ $fcontents .= $user.":".$this->users."\n";
45
6848
by: angelicdevil | last post by:
i have 2 tables 1 is status_type with field name status and other is users with field username and status now i want that the first listbox lists all status from status type ( this i have achieved with php ) and based on selection of the value in listbox 1 the corresponding data in table users be loaded in listbox 2 . i have achieved this by using a button in php but i want tht it operate without submit button and no page refreshing ...
0
8352
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
8802
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
8697
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
8579
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
7297
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...
0
5612
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();...
0
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
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
2
1587
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.