Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development

Reply
 
Thread Tools

JavaScript: working with forms
Old 12.02.2004, 10:47   #1
Web developer
 
Aram Ghazanchyan's Avatar
 
Join Date: 09 2002
Location: Yerevan
Age: 44
Posts: 896
Rep Power: 0
Default JavaScript: working with forms

I have such situation:

I have <select name="sel"></select> form element. Now I want to add an option with help of JavaScript, and write text there.
It should be something like this

---
document.forms[0].sel.addOption (addOption@ indzanic em horinel, et dzev method chka)
document.forms[0].sel.options[Novy Option ID].text = "Privet";
---

Old 12.02.2004, 11:17   #2
Web developer
 
Aram Ghazanchyan's Avatar
 
Join Date: 09 2002
Location: Yerevan
Age: 44
Posts: 896
Rep Power: 0
Default

Inqs gta

document.forms[0].sel.options[document.forms[0].sel.length] = new Option("My New Text", "My New Value")
Reply




Реклама:
реклама
Buy text link .

All times are GMT. The time now is 07:48.
Top

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.