I have a table with rows in, and each row has a few <td> elements. The last element has a checkbox in.
They are in a <div> which is set to runat="server". I have another checkbox on the page called "chkAll" that when clicked, I want to javascript check or uncheck all of the checkboxes in my table.
I'm not very good at Javascript, so I am not sure what to do. I added a javascript onclick method, and put document.getelementbyid and put in the div.clientID, but I wasnt sure what to do from there. Any ideas?
once you have the the <div> element as a reference, use getElementsByTagName() to get the <input> elements, then check the type property, if it's a checkbox then set it's checked property the same as the checked property of the checkbox chkAll. For example
function toggleCheckBoxes(elem) {
var div = document.getElementById('<% = divid.ClientID %>');
var chk = div.getElementsByTagName('input');
var len = chk.length;
for (var i = 0; i < len; i++) {
if (chk[i].type === 'checkbox') {
chk[i].checked = elem.checked;
}
}
}
and then attach this function as a click event handler of the chkAll element
<input type="checkbox" id="chkAll" onclick="toggleCheckBoxes(this)" />
Here's a Working Demo. add /edit to the URL to see the code
Since you are new to javascript I won't recommend using jQuery. Get basic ideas of javascript and then use jQuery.
Try this one
function CheckAll()
{
var tab = document.getElementById ( "tbl1" ); // table with id tbl1
var elems = tab.getElementsByTagName ( "input" );
var len = elems.length;
for ( var i = 0; i < len; i++ )
{
if ( elems[i].type == "checkbox" )
{
elems[i].checked = true;
}
}
}
If you are confident of using jQuery then you can use
$("#tbl1 input[type='checkbox']").attr ( 'checked' , true );
in the onclick function.
Try using jQuery - it makes javascript much easier and less verbose.
I think a solution to your problem can be found here:
http://www.iknowkungfoo.com/blog/index.cfm/2008/7/9/Check-All-Checkboxes-with-JQuery
Try the following:
in aspx:
<asp:CheckBox ID="chkAll" onclick="javascript:CheckUncheckall(this);" Text="Select" runat="server" />
<table id="tbl" runat="server">
<tr>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" Text="A" /></td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox2" runat="server" Text="B" /></td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox3" runat="server" Text="C" /></td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox4" runat="server" Text="D" /></td>
</tr>
<tr>
<td>
<asp:CheckBox ID="CheckBox5" runat="server" Text="E" /></td>
</tr>
</table>
and the javascript below:
<script language="javascript" type="text/javascript">
function CheckUncheckall(chk) {
var chks = document.getElementById("<% = tbl.ClientID %>").getElementsByTagName("input");
for(var i=0; i<chks.length; i++) {
if(chks[i].type == "checkbox") chks[i].checked= chk.checked;
}
}
</script>
I want to javascript check or uncheck
all of the checkboxes in my table
<table id="goofy">...</table>
Click me to check all boxes in table
And JavaScript:
function f() {
var inputs_in_table = document.getElementById("goofy").getElementsByTagName("input");
for(var i=0; i<inputs_in_table.length; i++) {
if(inputs_in_table[i].type == "checkbox") inputs_in_table[i].checked= true;
}
}
i have created a modified version using this script where you can pass table name and checkbox name dynamically.
Click here to get more infomarion
function checkedAll(container,chkID)
{
var tab = document.getElementById ( container ); // get table id which contain check box
var elems = tab.getElementsByTagName ( “input” );
for ( var i = 0; i < elems.length; i++ )
{
if ( elems[i].type == “checkbox” )
{
if ( document.getElementById(chkID).checked ==true)
elems[i].checked = true;
else
elems[i].checked = false;
}
}
}
You could save on looping elements here by using jquery to directly access checkboxes directly and then looping them.
$('input[type=checkbox]').each(function(){
this.checked = true
});
If you wanted to isolate a particular part of the page:
$(mydiv).find('input[type=checkbox]').each(function(){
this.checked = true
});
$('#checkall').click(
function () {
$('#divid').find('input[type=checkbox]').each(function () {
this.checked = $('#checkall').is(':checked')
});
});
In this, all checkboxes checked and unchecked by a single checkbox (checkall - id)
Related
I am trying to use the Slider control from AjaxControlTookit and my problem is that I cannot find a way to display non-numeric values inside the label bound to the slider. My code is like below..
Code:
<asp:TextBox ID="txtSlider" runat="server" style="display:none;/>
<ajaxToolkit:SliderExtender ID="slider1" runat="server" TargetControlID="txtSlider" Steps="3" BoundControlID="lblSliderValue" Minimum="1" Maximum="3" Orientation="Vertical"></ajaxToolkit:SliderExtender>
<asp:Label ID="lblSliderValue" runat="server" />
The lblSliderValue only shows me the values of 0,1 and 2, however I would need low, medium and high. So far I haven't found any way to specify these. I tried adding the textbox's OnTextChanged="txtSlider_textChanged" AutoPostBack="true" and set the lblSliderValue in code behind, with no succes. Any ideas on how to achieve this?
Such functionality doesn't implemented in slider. So let's customize it a bit.
At the first, you need to download toolkit sources. We will modify two files (I'll provide a links to codeplex for these files so you'll easy locate them in solution): SliderExtender.cs and SliderBehavior_resource.pre.js
Mark the SliderExtender class with this attribute: [ParseChildren(typeof(ListItem), ChildrenAsProperties = true)]
private List<ListItem> items = new List<ListItem>();
[PersistenceMode(PersistenceMode.InnerProperty)]
[ExtenderControlProperty]
[ClientPropertyName("items")]
public List<ListItem> Items
{
get { return items; }
}
static SliderExtender()
{
if (!ScriptObjectBuilder.CustomConverters.ContainsKey(typeof(ListItem)))
{
ScriptObjectBuilder.CustomConverters.Add(typeof(List<ListItem>), SerializeItemsToJson);
}
}
private static string SerializeItemsToJson(object itemsParam)
{
var items = itemsParam as List<ListItem>;
if (items == null)
return null;
return "{" + string.Join(",", items.Select(item => string.Format("{0}: '{1}'", item.Value, item.Text))) + "}";
}
That's all with server code so let's tweak client side code of extender.
Let's start with JavaScript code. Add to body of Sys.Extended.UI.SliderBehavior function this item: this._items = null;
And add to prototype of Sys.Extended.UI.SliderBehavior function code below:
get_items: function () {
return this._items;
},
set_items: function (value) {
if (Sys.Serialization.JavaScriptSerializer.serialize(this._items) != value) {
this._items = Sys.Serialization.JavaScriptSerializer.deserialize(value);
this.raisePropertyChanged('items');
}
}
Then, modify the _calcValue function as following:
_calcValue: function (value, mouseOffset) {
var val;
if (value != null) {
if (!Number.isInstanceOfType(value)) {
if (this._items) {
for (var prop in this._items) {
if (this._items.hasOwnProperty(prop) && this._items[prop] === value) {
value = prop;
break;
}
}
}
//rest of function's code stays as it is
And the last step - fix the _ensureBinding function:
_ensureBinding: function () {
if (this._boundControl) {
var value = this._value;
var displayItem = this._items && this._items.hasOwnProperty(value) ? this._items[value] : null;
if (value >= this._minimum || value <= this._maximum) {
var isInputElement = this._boundControl.nodeName == 'INPUT';
if (isInputElement) {
this._boundControl.value = displayItem || value;
}
else if (this._boundControl) {
this._boundControl.innerHTML = displayItem || value;
}
}
}
}
After all changes above, rebuild solution and add reference on toolkit dll to your project. Sample of usage of modified slider here. And it still support two-way binding (i.e. from extender to label but not from bounded textbox to extender).
<asp:TextBox ID="Slider1" runat="server" />
<br />
<ajaxToolkit:SliderExtender ID="SliderExtender1" runat="server" BehaviorID="Slider1"
TargetControlID="Slider1" Minimum="1" Maximum="3" BoundControlID="Slider1_BoundControl"
Steps="5">
<Items>
<asp:ListItem Value="1" Text="Low" />
<asp:ListItem Value="2" Text="Medium" />
<asp:ListItem Value="3" Text="High" />
</Items>
</ajaxToolkit:SliderExtender>
<asp:TextBox runat="server" ID="Slider1_BoundControl" />
<%--<asp:Label ID="Slider1_BoundControl" runat="server" Style="text-align: right" />--%>
I am using Ajax toolkit with a combobox functionality, the items being displayed are around 40,000, so I want to apply a filter on the same, so that a user types an alphabet in the combobox and corresponding entries with starting alphabet "a" will be displayed in the combobox.
Can I have an idea, I am not using Radcombobox, it is a simplest combobox.
<asp:ComboBox ID="AppComCombx" runat="server"
CssClass="dropdownpersonal textfont"
onselectedindexchanged="AppComCombx_SelectedIndexChanged" AutoPostBack="true">
</asp:ComboBox>
Try this : AutoCompleteMode = "SuggestAppend"
Like this
<ajaxToolkit:ComboBox ID="ComboBox1" runat="server"
AutoPostBack="False"
DropDownStyle="DropDownList"
AutoCompleteMode="SuggestAppend"
CaseSensitive="False"
CssClass=""
ItemInsertLocation="Append" />
For more info go here
Add to the ScriptManager reference on js file with script below and use Suggest or None mode for combo
Sys.Application.add_load(function () {
Sys.Extended.UI.ComboBox.prototype._ensureHighlightedIndex = function () {
// highlight an index according to textbox value
var textBoxValue = this.get_textBoxControl().value;
// first, check the current highlighted index
if (this._highlightedIndex != null && this._highlightedIndex >= 0
&& this._isExactMatch(this._optionListItems[this._highlightedIndex].text, textBoxValue)) {
return;
}
// need to find the correct index
var firstMatch = -1;
var ensured = false;
var children = this.get_optionListControl().childNodes;
for (var i = 0; i < this._optionListItems.length; i++) {
var itemText = this._optionListItems[i].text;
children[i].style.display = this._isPrefixMatch(itemText, textBoxValue) ? "list-item" : "none";
if (!ensured && this._isExactMatch(itemText, textBoxValue)) {
this._highlightListItem(i, true);
ensured = true;
}
// if in DropDownList mode, save first match.
else if (!ensured && firstMatch < 0 && this._highlightSuggestedItem) {
if (this._isPrefixMatch(itemText, textBoxValue)) {
firstMatch = i;
}
}
}
if (!ensured) {
this._highlightListItem(firstMatch, true);
}
};
});
AutoCompleteExtender is better choice in this case as all the way ComboBox will render all items on a page
In button click event how can I check all check boxes in gridview?
I dont need header checkbox.
Please provide your knowledge
awaiting your response....
Thanks
<input id="btncheckall" type="button" value="select all" />
add click event handler to button above (with jQuery)
<script type="text/javascript">
$(function(){
$("#btncheckall").click(function(){
$("#gridview input:checkbox").attr("checked","checked");
});
});
</script>
or you can use checkbox.
this is a checkbox outside gridview
<input id="checkall" type="checkbox" />
add change event handler to checkbox above (with jQuery)
<script type="text/javascript">
$(function(){
$("#checkall").change(function(){
$("#gridview input:checkbox").val( $(this).val() );
});
});
</script>
Assign a class to all your grid row check boxes and use the below script to get them all.
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
And you've to call it this way:
var messages = getElementsByClass("childbox");
Assign a class childbox to grid row child box.
document.getElementById("parentbox").onclick = function() {
for(var index=0; index < messages.length; index++) {
// prompt the content of the div
//message[index].checked = (message[index].checked) ? false : true;
}
}
you'll assign the parentbox class to the parent checkbox which is in grid header.
You don't need to define them - parentbox and childbox.
C#
Let's say you have a check all button
<asp:CheckBox ID="chkSelectAll" runat="server" Text="SelectAll"
AutoPostBack="true" OnCheckedChanged="chkSelectAll_CheckedChanged" />
and in that click event you would do something like:
protected void chkSelectAll_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk; //assuming your gridview id=GridView1
foreach (GridViewRow rowItem in GridView1.Rows)
{
chk = (CheckBox)(rowItem.Cells[0].FindControl("chk1"));
chk.Checked =((CheckBox)sender).Checked;
}
}
javascript approach:
<script language="javascript">
function SelectAllCheckboxes(spanChk){
// Added as ASPX uses SPAN for checkbox
var oItem = spanChk.children;
var theBox= (spanChk.type=="checkbox") ?
spanChk : spanChk.children.item[0];
xState=theBox.checked;
elm=theBox.form.elements;
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" &&
elm[i].id!=theBox.id)
{
//elm[i].click();
if(elm[i].checked!=xState)
elm[i].click();
//elm[i].checked=xState;
}
}
</script>
Checkbox field as so:
<asp:CheckBox ID="chkAll" runat="server" Text="SelectAll"
onclick="javascript:SelectAllCheckboxes(this);" />
Hai Dominic,
If you want javascript look at this
https://web.archive.org/web/20210304130956/https://www.4guysfromrolla.com/articles/052406-1.aspx#postadlink
or
Check box in gridview with button
Jquery can make this easier. Hook into the external boxes onslected event, and inside there iterate the grid boxes selecting them all.
This is a great example of the evils of asp.net and how it's use by new developers really cripples them into thinking that all processing and interaction takes place server side, and all sorts of crazy hacks take place to maintain this illusion. It's backwards and insane.
Try this:
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<HeaderTemplate><asp:CheckBox ID="SelectUnSelectAllCheckBox" runat="server" /></HeaderTemplate>
<ItemTemplate><asp:CheckBox ID="SelectCheckBox" runat="server" /></ItemTemplate>
</asp:TemplateField>
<!-- Other columns are omitted -->
</Columns>
</asp:GridView>
<script type="text/javascript">
$(document).ready(function(e) {
$("input[id$='SelectUnSelectAllCheckBox']").change(function() {
$("input[id$='SelectCheckBox']").attr("checked", this.checked);
});
});
</script>
If you're using jquery you could use the $('input:checkbox') selector so something like
<script type="text/javascript">
$(function() {
$('#NameOfButtonToSelectAll').click( function() {
$('input:checkbox').each( function() {
this.checked = !this.checked;
});
});
});
</script>
Kindly check it out and let me know when you got it worked.
Using Javascript :
http://wiki.asp.net/page.aspx/281/check-uncheck-checkboxes-in-gridview-using-javascript/
Using Serverside Script: (VB.Net)
https://web.archive.org/web/20211020145756/https://aspnet.4guysfromrolla.com/articles/052406-1.aspx
Using jQuery:
$('#SelectAll').click(function(){
var checked = $(this).is(':checked');
var allCheckboxes = $('table input:checkbox');
if(checked)
allCheckboxes.attr('checked','checked');
else
allCheckboxes.removeAttr('checked');
});
You probably want to change the selectors, assuming you have a class for your grid and checkbox.
In asp.net if you define an asp:ListBox as follows:
<asp:ListBox ID="listBox2" runat="server" SelectionMode="Single" Rows="3">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem Selected="True">8</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
</asp:ListBox>
You will see that the selected item is visible at the top. But if you define it as a multiple selection list box, the selected items are not visible, and you have to scroll down the list to find them.
<asp:ListBox ID="listBox1" runat="server" SelectionMode="Multiple" Rows="3">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem Selected="True">8</asp:ListItem>
<asp:ListItem Selected="True">9</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
</asp:ListBox>
I've done a bit of google searching, and see that this is not an uncommon problem. But I did not find any good solutions, so thought I would ask here.
My first thought was to try a bit of JQuery to solve this. What are some of your solutions?
Several of the answers don't even understand my problem. I only care about ensuring that the first selected option is visible. Make sure it is scrolled into view.
I played around with JQuery, and came up with the following:
<script type="text/javascript">
$(document).ready(function() {
$("#listBox1 option:nth-child(8)").attr('selected',true);
});
</script>
But I think I like #Cerebrus's answer the best.
Here's how I've done it in the past. Note that this scrolls the view to the last item in the listbox.
function FocusSelected()
{
var lb = document.getElementById("listBox1");
if (lb != null)
{
var options = lb.options;
for (var i = options.length - 1; i > 0 ; i--)
{
if (options[i].selected == true)
{
options[i].focus();
options[i].selected = true;
return;
}
}
}
}
It works for me on IE 7 and FF 3.0.
How are you looking to call this?
From Javascript:
<script type="text/javascript">
var myselect=document.getElementById("listBox1")
for (var i=0; i<myselect.options.length; i++){
if (myselect.options[i].selected==true){
alert("Selected Option's index: "+i)
break;
}
}
From the Code Behind:
foreach (ListItem li in listBox1.Items)
{
if (li.Selected)
{
return li;
}
}
It's bit clumsy, but I've done this once, and would welcome a better solution.
//get the selected value
var selected = (from l in lstFilterUsers.Items.Cast<ListItem>()
orderby l.Value
where l.Selected == true
select l).Take(1);
//get all the values except for that first selection
var all = (from l in lstFilterUsers.Items.Cast<ListItem>()
where l != selected
orderby l.Value
select l);
//create a temp array and fill it
ListItem[] lic = new ListItem[lstFilterUsers.Items.Count];
lic[0] = (ListItem)selected;
int i = 1;
foreach (var li in all)
{
lic[i++] = li;
}
//clear the listbox
lstFilterUsers.Items.Clear();
//readd the list
lstFilterUsers.Items.AddRange(lic);
In my limited experimentation, both Chrome and Firefox do the scrolling automatically.
For IE, I cooked this hacky bit of jQuery code up (tested on IE7):
$(document).ready(function(){
scrollToFirstSelection('select');
});
function scrollToFirstSelection(query) {
var select = $(query);
var singleOption = select.find('option')[0];
var heightOfSingleOption = select[0].offsetHeight / select.attr('size');
var indexOfFirstSelection = select.find('option').index($('option[selected=true]:first'));
select[0].scrollTop = heightOfSingleOption * indexOfFirstSelection;
}
It might not be exact if you use any crazy padding or margins, but it should be close enough.
I modified the code so as to get consistent result in both IE and FF, using scrollTo dependency for FF :
$('select').each(function () {
var options = $(this).find('option');
for (var i = options.length - 1; i > 0; i--) {
if (options[i].selected == true) {
var x = options[i];
if (jQuery.browser.msie) {
x.focus();
x.selected = true;
} else {
$(x).parents('select:eq(0)').scrollTo(x, 0);
}
return;
}
}
});
I've found that one line of client-side jQuery code solves this issue. For a multi-select listbox that arrives at the client with one or more selected options, use the power of selectors to find the first selected option. For some reason, simply calling focus() alone doesn't work, but resetting the selected to selected again will then have it scroll the selected element into view.
$(document).ready(function () {
// Scroll to **FIRST** selected option in multi select list
$("#lstCountries option:selected(:first)").focus().prop('selected', 'selected');
// Scroll to **LAST** selected option in multi select list
$("#lstStates option:selected").focus().prop('selected', 'selected');
});
Inherited an app with a page that has a link that calls the javascript function addValueClick(), when I do this a dialog box pops up, I type in some text, and then the text gets put in the select box. Every time a new option is added to the select it gets about 5 pixels narrower. I can't figure out why this is happening, but it only happens in IE7
Here is the javascript:
function addValueClick()
{
var newValue = prompt("Please enter a new value.","");
if (newValue != null && newValue != "")
{
var lst = document.getElementById("lstValues");
var opt = document.createElement("option");
opt.setAttribute("selected", "true");
opt.appendChild(document.createTextNode(newValue));
lst.appendChild(opt);
updateBtns();
copyValues();
}
}
function copyValues()
{
var frm = document.forms[0];
var lst = frm.elements["lstValues"];
var hid = frm.elements["hidValues"];
var xml = "<root>";
for (var i = 0; i < lst.options.length; i++)
{
xml += "<value seq_num=\"" + (i + 1) + "\">" +
lst.options[i].text + "</value>";
}
xml += "</root>";
hid.value = xml;
}
function updateBtns()
{
var lst = document.getElementById("lstValues");
var iSelected = lst.selectedIndex;
var lnkEdit = document.getElementById("lnkEditValue");
var lnkDelete = document.getElementById("lnkDeleteValue");
var lnkUp = document.getElementById("lnkValueUp");
var lnkDown = document.getElementById("lnkValueDown");
if (iSelected == -1)
{
lnkEdit.style.visibility = "hidden";
lnkDelete.style.visibility = "hidden";
lnkUp.style.visibility = "hidden";
lnkDown.style.visibility = "hidden";
}
else
{
lnkEdit.style.visibility = "visible";
lnkDelete.style.visibility = "visible";
if (iSelected == 0)
lnkUp.style.visibility = "hidden";
else
lnkUp.style.visibility = "visible";
if (iSelected == lst.options.length - 1)
lnkDown.style.visibility = "hidden";
else
lnkDown.style.visibility = "visible";
}
}
EDIT:
The HTML, it's actually ASP.NET. All the listValueChanged() method does is call updateButtons() above.
<tr>
<TD class=body vAlign=top noWrap align=right><b>Values:</TD>
<TD class=body vAlign=top noWrap align=left><asp:ListBox id="lstValues" runat="server" onchange="lstValuesChange();" Rows="9" onselectedindexchanged="lstValues_SelectedIndexChanged"></asp:ListBox></TD>
<TD class=body vAlign=top noWrap align=left>
<TABLE id="Table2" cellSpacing="2" cellPadding="2" border="0">
<TR>
<TD noWrap>
<asp:HyperLink id="lnkAddValue" runat="server" NavigateUrl="javascript:addValueClick();">Add</asp:HyperLink></TD>
</TR>
<TR>
<TD noWrap>
<asp:HyperLink id="lnkEditValue" runat="server" NavigateUrl="javascript:editValueClick();">Edit</asp:HyperLink></TD>
</TR>
<TR>
<TD noWrap>
<asp:HyperLink id="lnkDeleteValue" runat="server" NavigateUrl="javascript:deleteValueClick();">Delete</asp:HyperLink></TD>
</TR>
<TR>
<TD noWrap> </TD>
</TR>
<TR>
<TD noWrap>
<asp:HyperLink id="lnkValueUp" runat="server" NavigateUrl="javascript:valueUpClick();">Up</asp:HyperLink></TD>
</TR>
<TR>
<TD noWrap>
<asp:HyperLink id="lnkValueDown" runat="server" NavigateUrl="javascript:valueDownClick();">Down</asp:HyperLink></TD>
</TR>
</TABLE>
</TD>
</TR>
It may have more to do with the html than the script. What is the select contained in? Based on the JS, I don't think there are any problems here.
I know that adding options via SelectElement.innerHTML = '...'; fails in IE (bug 274).
But I don't know about adding options via .createElement() failing... although I'm not overly surprised.
You can use the JavaScript new Option(); syntax to create them, I'm fairly certain that works without failure.
The issue was where the Option was being added to the Select I changed it to the following and it works perfectly:
function addValueClick()
{
var newValue = prompt("Please enter a new value.","");
if (newValue != null && newValue != "")
{
var lst = document.getElementById("lstValues");
var opt = document.createElement("option");
opt.text = newValue;
opt.value = newValue;
try {
lst.add(opt, null); // real browsers
}
catch (ex) {
lst.add(opt); // IE
}
updateBtns();
copyValues();
}
}