:: Forum >> Version 2 >>

How to give ID to checkbox in CheckedList

Hi,
Please create one file and put this code inside that file (Your runtime folder and created file should be present in same folder).
<html>
<head>
<title>ActiveWidgets Examples</title>
<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
<style>
body {font: menu}
p {margin: 10px 0px 5px 0px}
table {font: menu; table-layout: fixed}
</style>
<script language="javascript">
function selectlist()
{
alert(obj.getSelectedItems());
}
</script>
</head>
<body class="aw-body">
<p>
Checked List:
</p>
<script>
var obj = new AW.UI.CheckedList;
obj.setItemText(["Home", "Favorites", "Font size", "Search"]);
obj.setItemImage(["home", "favorites", "fontsize", "search"]);
obj.setItemCount(4);
document.write(obj);
</script>
<p> <input type="button" value="Ok" onClick="javascript:selectlist();">
</p>
</body>
</html>
Now select first checkbox and click on 'Ok' button you will get output as 0 . Now select first and second checkbox and click on 'Ok' you will get 0,1 as output.

I want to give an id to each checkbox such as 10,20 etc. So that when i select first and second checkbox it should produced output 10,20.
Vivek
Monday, June 5, 2006
Yes, its posiible with custom item indices -

var obj = new AW.UI.CheckedList;
    
obj.setItemText({10:"Home"20:"Favorites"30:"Font size"40:"Search"});
    
obj.setItemImage({10:"home"20:"favorites"30:"fontsize"40:"search"});
    
obj.setViewIndices([10203040]);
    
obj.setViewCount(4);
    
document.write(obj);

 
Alex (ActiveWidgets)
Monday, June 5, 2006



This topic is archived.

Back to support forum

Forum search