Просмотр полной версии : добавить option в select средствами js?
document.write()
<element_id>.innerHTML
<select_id>.add()
Еще ?
KidsKilla
02.03.2006, 20:58
// создаём select:
var sel = document.createElement("select");
document.body.appendChild(sel);
sel.setAttribute("id", "select_"+n);
sel.setAttribute("name", n);
// создаём option:
var opt = null;
opt = document.createElement("option");
opt.setAttribute("value", "your value");
opt.appendChild(document.createTextNode("text in option"));
sel.appendChild(opt);
спасибо. особое спасибо 2KidsKilla за развернутый ответ :rolleyes:
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.