Armenian Knowledge Base  

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

Reply
 
LinkBack Thread Tools
Old 12.02.2004, 10:47   #1
Web developer
 
Aram Ghazanchyan's Avatar
 
Join Date: 09 2002
Location: Yerevan
Age: 37
Posts: 896
Downloads: 1
Uploads: 0
Reputation: 9 | 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 ([email protected] indzanic em horinel, et dzev method chka)
document.forms[0].sel.options[Novy Option ID].text = "Privet";
---
Reply With Quote
Old 12.02.2004, 11:17   #2
Web developer
 
Aram Ghazanchyan's Avatar
 
Join Date: 09 2002
Location: Yerevan
Age: 37
Posts: 896
Downloads: 1
Uploads: 0
Reputation: 9 | 0
Default

Inqs gta

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

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 14:15.


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