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

Change list item text

Hi

Forgive me if a stupid question but . . .

I have
[HTML]<ul>
<li id='menu1'>MENU ONE</li>
<li id='menu2'>MENU TWIO</li>
<li id='menu3'>MENU ONE</li>
....... etc....
</ul>[/HTML]

and some Javascript

Expand|Select|Wrap|Line Numbers
  1. function updateMenu(item) {
  2.     menuID="menu" + document.theform.which.value;
  3.     document.getElementById(menuID).value=item.value;
  4. }
I have checked menuID & it is correct( 'menu3' )

item.value is also good text

What is wrong ???
Oct 29 '07 #1
6 3821
epots9
1,351 Expert 1GB
where is the part of the code that calls the "updateMenu" function?
Oct 29 '07 #2
Sorry - incomplete submission

the updateMenu is called from an onChange event in a form.

so <input type='text' id='shortform' value='' onChange='updateMenu(this)'>

Further reading seems to imply that the <li> element's value is actually its position in the list.
How can I change the associated text ?
Oct 29 '07 #3
acoder
16,027 Expert Mod 8TB
You could use innerHTML instead.
Oct 29 '07 #4
acoder
16,027 Expert Mod 8TB
Changed the thread title to better describe the problem.
Oct 29 '07 #5
Thanks - innerHTML - I just came back to say I had discovered this solution only to find the suggestion waiting here for me !

I embedded <span id='menu1'> ...pure text... </span>
since I have some other stuff within the <li> . . .</li>


Is this cross-browser safe ?
Oct 29 '07 #6
acoder
16,027 Expert Mod 8TB
Yes, though it's not part of the standards, it should work in pretty much all modern browsers.
Oct 29 '07 #7

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

Similar topics

4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
7
by: juglesh | last post by:
Hello, I would like to be able to have the user sort a list of items similarly to the way you sort your queue on Netflix.com. (the numbers dont change dynamically on netflix, they must be doing...
13
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture'...
2
by: Billy | last post by:
Change DataGrid EditControl On Data Value Hi, I have a datagrid, and on editing, I want to change the control in the third colunm based on the value of the first column. The value in the...
6
by: ahart | last post by:
I'm pretty new to python and am trying to write a fairly small application to learn more about the language. I'm noticing some unexpected behavior in using lists in some classes to hold child...
3
by: John Smith | last post by:
I'm looking into this peace of code: protected void DropDown_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as...
2
by: John Smith | last post by:
Will this line of the code: item.Cells.Text = "Some text..."; change only DataGrid visual value or it will also change value in the DataSource? How can I change value in DataSource? ...
10
by: OldBirdman | last post by:
On a Report, can I change any of the fields in the "Sorting and Grouping Dialog" from within Visual Basic??? Changing the OrderBy property of the Report doesn't change anything, nor does adding an...
3
by: CSharper | last post by:
Is it possible to selectivly change the color of an item in text. I saw ForeColor option, but it changes the color of all the items. If it is not possible, is there any other control list listbox...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.