473,472 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
Create 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.options[i].valueOf() + ",";
}
var lastComma = values.lastIndexOf(',');
values = values.substring(0,lastComma);

return values;
}

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

for(i=0; i<=selLength1-1; i++)
{
values=sel1.options[i].valueOf() + ",";
}
var lastComma = values.lastIndexOf(',');
values = values.substring(0,lastComma);

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

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

May 3 '07 #2
On May 3, 9:36 am, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On May 3, 7:12 am, tks...@gmail.com wrote:
Hi,
function listBoxContents(sel1)
{
var selLength1 = sel1.length;
var i;
var values;
for(i=0; i<=selLength1-1; i++)
{
values=sel1.options[i].valueOf() + ",";
}
var lastComma = values.lastIndexOf(',');
values = values.substring(0,lastComma);
return values;}

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

for(i=0; i<selLength1; i++)
values+=sel1.options[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.length,i,values='';

for(i=0; i<selLength1; i++)
values+=sel1.options[i].value+ ",";
document.writeln("<input type='hidden' name='hiddenValues' value='"
+ values.slice(0,-1) + "'>");
}

May 3 '07 #3
tk****@gmail.com 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.length,i,values='';

for(i=0; i<selLength1; i++)
values+=sel1.options[i].value+ ",";
document.writeln("<input type='hidden' name='hiddenValues' value='"
+ values.slice(0,-1) + "'>");
}
function listBoxContents(sel1)
{
var selLength1 = sel1.options.length,i,values='';

for(i=0; i<selLength1; i++)
values+=sel1.options[i].value+ ",";
var input=document.createElement("input");
input.name="hiddenValues";input.type="hidden";
input.value=values.slice(0,-1);
document.body.appendChild(input);
}

May 3 '07 #4

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

Similar topics

1
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
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...
4
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...
1
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...
0
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...
1
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...
12
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. ...
2
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...
45
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.