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

adding items to a list or menu

Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

thanks for any suggestions

Roy
The Netherlands

Jul 17 '05 #1
5 2730

"R.G. Vervoort" <ro**********@royvervoort.nl> wrote in message
news:40*********************@news.xs4all.nl...
Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

thanks for any suggestions

Roy
The Netherlands


You're right. That's a JavaScript question. comp.lang.javascript is
thataway. Sorry.

Oh, and don't cross-post.

Garp
Jul 17 '05 #2
"R.G. Vervoort" <ro**********@royvervoort.nl> wrote in message
news:40*********************@news.xs4all.nl...
Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

thanks for any suggestions


Just to piss off the other guy, here's the JS code for adding an item

var o = document.createElement('OPTION');
o.innerText = textfield1.value;
o.value = 'Something';
document.getElementById('listbox_id').appendChild( o);

HTML:

<select id="listbox_id">
<option>Hello</option>
...
</select>

Jul 17 '05 #3
"R.G. Vervoort" <ro**********@royvervoort.nl> wrote in message news:<40*********************@news.xs4all.nl>...
Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

thanks for any suggestions

Roy
The Netherlands


PHP is server side, it looks like you want to send items to a client
side app (javascript?) you could do something like this:

--->Snip!

<?php

$array = array('item1', 'item2', 'item3', 'item4'); //I use an array
here for simplicity, you could do the same with a dB query or the like

echo "<html>\n<head></head><!--javascript-->"; //Not a javascript guy,
but you get the point

foreach($array as $key=>$item) {
echo "\n textdata.item$key=$item";
}

?>
<body> etc.....

<---

Not sure how javascript looks (started working with it in last 2 days)
but you can change that echo statement to what it should be in
javascript

Cheers!

Robert
Jul 17 '05 #4

"Chung Leong" <ch***********@hotmail.com> wrote in message
news:1L********************@comcast.com...
"R.G. Vervoort" <ro**********@royvervoort.nl> wrote in message
news:40*********************@news.xs4all.nl...
Not sure if it is a php question but since i am working in php here it is.
Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

thanks for any suggestions


Just to piss off the other guy, here's the JS code for adding an item

var o = document.createElement('OPTION');
o.innerText = textfield1.value;
o.value = 'Something';
document.getElementById('listbox_id').appendChild( o);

HTML:

<select id="listbox_id">
<option>Hello</option>
...
</select>


Heh, if you mean me as "the other guy", I'm happy he got his answer. And
when he asks which lace to cross next in four groups, you can help there too
(and repeat his cross-post again).

Hugs.

Garp
Jul 17 '05 #5
"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:%j*********************@news-text.cableinet.net...
Heh, if you mean me as "the other guy", I'm happy he got his answer. And
when he asks which lace to cross next in four groups, you can help there too (and repeat his cross-post again).


Oops. Didn't even check the to line.
Jul 17 '05 #6

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

Similar topics

2
by: R.G. Vervoort | last post by:
Ho can i add items to (the item label=visual text and the value=index number) a list object on a website. I am having a list with 4 items and i would like to add the text from a textfield...
2
by: DFS | last post by:
I inadvertently deleted all the items from the built-in Access97 Window menu: Tile Horizontally, Tile Vertically, Cascade, etc. Can I somehow get them back without reinstalling Access97 (or...
0
by: Claire | last post by:
When I run the following code through on the first round, my sub-menu (branched off mnuOpenPorts menuitem) shows a nice list of ports. When it gets run through on the 2nd pass, the sub menu...
4
by: Claire | last post by:
Sorry Ive added this twice (sortof) but if I'd added an addendum to the first one then this would probably have been ignored. This problem affects a ContextMenu attached to a NotifyIcon object. I...
10
by: tmaster | last post by:
When I try to dynamically add a second sub menu item to this ContextMenu item, I get an error 'Specified argument was out of the range of valid values'. Private Sub mnuTopics_Show_Select(ByVal...
0
by: Dino M. Buljubasic | last post by:
I have several context menu added to my forms. The forms are displaying items in a list view. When I click on an item in a list view, a popup context menu shows allowing me to chese between...
1
by: stinehelferw | last post by:
I need a right-click menu on a form list control with combobox controls. I used View->Toolbars->Customize to create a toolbar. I added ComboBox through commands tab. I set properties to Popup...
2
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more...
2
by: RLN | last post by:
I was at this link to add a menu bar to my Access app. http://office.microsoft.com/en-s/access/HP051890341033.aspx I got the menu bar added, but had some more questions about it. In the link...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.