y el codigo es el siguiente:
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>CheckListBox Property Test</title> <meta content="VBScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/nav4-0" name="vs_targetSchema"> <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR"> <meta content="VisualStudio.HTML" name="ProgId"> <meta content="Microsoft Visual Studio.NET 7.0" name="Originator"> <script language="vbscript" id="clientEventHandlersVBS"> <!-- ' CheckListBox ActiveX Control sample ' Copyright (c)1996-2003 Zeal SoftStudio. ' Web: [url]http://www.zealsoft.com[/url] (English) ' [url]http://zealsoft.nease.net/[/url] (Chinese) ' E-Mail: [email][email protected][/email] Sub window_onload ' Add strings to the control Dim sDir sDir = Replace(Unescape(document.URL), "Default.html", "") sDir = Replace(sDir, "file://", "") For i = 1 To 10 Chklist1.AddItem "Item " & i If i Mod 2 = 1 Then Set ChkList1.ItemImage(ChkList1.NewIndex) = _ LoadPicture(sDir + "chemical.ico") ChkList1.ItemBackColor(ChkList1.NewIndex) = RGB(255, 255, 192) Else Set ChkList1.ItemImage(ChkList1.NewIndex) = _ LoadPicture(sDir + "construc.ico") ChkList1.ItemBackColor(ChkList1.NewIndex) = RGB(255, 192, 192) End If Next ' Add a disabled item ChkList1.AddCheckedItem "This item is disabled." ChkList1.Grayed(ChkList1.NewIndex) = True ChkList1_Click End Sub Sub Select1_onclick Chklist1.setAttribute "Style", select1.value End Sub Sub btnAdd_onclick Dim s s = InputBox("Enter a string:", "Add Item") If s <> "" Then ChkList1.AddItem s End If ChkList1_click End Sub Sub Chklist1_click lblResult.innerText = "Count of List = " & ChkList1.ListCount _ & ", count of checked items = " & ChkList1.CheckedCount End Sub Sub btnRemove_onclick If ChkList1.ListIndex = -1 Then PromptSelect Else ChkList1.RemoveItem ChkList1.ListIndex ChkList1_Click End If End Sub Sub PromptSelect() MsgBox "You must select an item in CheckListBox first!", 64 End Sub Sub btnCheckAll_onclick Chklist1.CheckAll Chklist1_Click End Sub Sub btnClear_onclick Chklist1.clear Chklist1_Click End Sub Sub btnEdit_onclick Dim s If ChkList1.ListIndex = -1 Then PromptSelect Else s = InputBox("Enter a string:", "Edit", ChkList1.Text) If s <> "" Then ChkList1.List(ChkList1.ListIndex) = s End If End Sub Sub Checkbox1_onclick Chklist1.NoCheckmark = Checkbox1.checked End Sub Sub Checkbox2_onclick Chklist1.Enabled = Checkbox2.checked End Sub Sub Select3_onclick Chklist1.ToggleMode = select3.value End Sub Sub Select2_onclick Chklist1.CheckAlignment = select2.value End Sub --> </script> </head> <body ms_positioning="GridLayout"> <table height="431" cellspacing="0" cellpadding="0" width="566" border="0" ms_2d_layout="TRUE"> <tr valign="top"> <td colspan="5" height="31"><b>Style:</b> <select id="Select1" name="Select1"> <option value="0" selected>0-AutoDetect</option> <option value="1">1-Windows 3.x</option> <option value="2">2-Windows 95</option> <option value="3">3-Borland</option> <option value="4">4-CTL3D</option> <option value="5">5-Diamond 3D</option> <option value="6">6-Diamond 2D</option> <option value="7">7-True and False</option> <option value="8">8-Plus and Minus</option> <option value="9">9-Circle</option> <option value="10">10-Custom</option> <option value="11">11-Windows XP</option> </select> </td> </tr> <tr valign="top"> <td colspan="5" height="31"><b>Toggle:</b> <select id="Select3" name="Select3"> <option value="0" selected>0-Single click</option> <option value="1">1-Click on mark</option> <option value="2">2-Double Click</option> </select> </td> </tr> <tr valign="top"> <td colspan="6" height="29"> <div ms_positioning="FlowLayout"> <b>Alignment:</b> <select id="Select2" name="Select2"> <option value="0" selected> 0-Left</option> <option value="1"> 1-Right</option> </select> </div> </td> </tr> <tr valign="top"> <td colspan="2" height="29"> <div></div> <input id="Checkbox1" type="checkbox" name="Checkbox1"> No Checkmark <div ms_positioning="FlowLayout"> </div> </td> <td colspan="3" height="29"> <input id="Checkbox2" type="checkbox" CHECKED name="Checkbox2"> Enable </td> </tr> <tr valign="top"> <td colspan="2" rowspan="5"> <object id="Chklist1" height="243" width="261" classid="clsid:22A21987-4FA2-11D1-AF19-444553540000"> <param name="_Version" value="65544"> <param name="_ExtentX" value="6906"> <param name="_ExtentY" value="6429"> <param name="_StockProps" value="221"> <param name="Text" value=""> <param name="ForeColor" value="-2147483640"> <param name="BackColor" value="-2147483643"> <param name="Enabled" value="-1"> <param name="Appearance" value="1"> <param name="ToggleMode" value="0"> <param name="ShowFocusRect" value="-1"> <param name="SortMode" value="0"> <param name="CheckAlignment" value="0"> <param name="NoCheckmark" value="0"> <param name="MultiSelect" value="0"> <param name="Redraw" value="-1"> <param name="KeyFind" value="-1"> <param name="Style" value="0"> <param name="ItemHighLight" value="-1"> <param name="Sorted" value="0"> <param name="ImageStretch" value="-1"> <param name="ItemHeight" value="0"> <param name="BackColor" value="-2147483643"> <param name="ForeColor" value="-2147483640"> <param name="Appearance" value="1"> </object> </td> <td colspan="3"> <input id="btnAdd" type="button" value="Add Item " name="Button14"> </td> </tr> <tr valign="top"> <td colspan="3"> <input id="btnRemove" type="button" value="Remove Item" name="Button13"> </td> </tr> <tr valign="top"> <td colspan="3"> <input id="btnEdit" type="button" value="Edit " name="Button1"> </td> </tr> <tr valign="top"> <td colspan="3"> <input id="btnClear" type="button" value="Clear " name="Button12"> </td> </tr> <tr valign="top"> <td colspan="3"> <input id="btnCheckAll" type="button" value="Check All " name="Button1"> </td> </tr> <tr valign="top"> <td colspan="6"> <div id="lblResult" ms_positioning="FlowLayout"> <table height="23" cellspacing="0" cellpadding="0" width="430" border="0" ms_1d_layout="TRUE"> <tr> <td></td> </tr> </table> </div> </td> </tr> <tr valign="top"> <td colspan="6"> <div ms_positioning="FlowLayout"> Copyright © 1997-2003, <a href="http://www.zealsoft.com">Zeal SoftStudio</a></div> </td> </tr> </table> </body> </html>