rameshk
03-27-2008, 12:46 PM
Hi Guys,
I am not able to understand why it is not working? If you look the code it is pretty simple.. I m just creating label and assigning this to my checkbox nothing else... .
Immediage help will be appriciated lot... :)
You can look the code its very simple just creation of checkbox followed by creation of label box... for joining purpose.
========== Code Start ================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script lanaguage="JavaScript">
function testonload()
{
var context = document.getElementById("context");
var inputs = new Array();;
var filters = document.createElement('div');
context.appendChild(filters);
var Feedlist = "Alerts,Events,Message";
var feedNames = Feedlist.split(",");
for(i=0; i<feedNames.length; i++){
// Create a unique ID for the checkbox based on the widget ID
var inputID = "KKK" + "-filter-" + feedNames[i];
// Create an input the wacky IE-way
if (document.all) {
var strInput = "<input type='checkbox' id='"+inputID+"' value='"+feedNames[i]+"' checked='checked' />";
inputs[i] = document.createElement(strInput);
}
// Other browsers...
else {
inputs[i] = document.createElement('input');
inputs[i].type = 'checkbox';
inputs[i].id = inputID;
inputs[i].value = feedNames[i];
inputs[i].checked = true;
}
filters.appendChild(inputs[i]);
var label = document.createElement("label");
label.className = "inline";
label.setAttribute("for", inputID);
label.innerHTML = feedNames[i];
filters.appendChild(label);
//YAHOO.util.Event.on(this.inputs[i], 'click', this.updateDataTable, this, true);
}
}
</script>
</head>
<html>
<body onload="testonload()">
<div id="context">
</div>
</body>
</html>
========== Code End =================
Thanks in Advance,
RK
I am not able to understand why it is not working? If you look the code it is pretty simple.. I m just creating label and assigning this to my checkbox nothing else... .
Immediage help will be appriciated lot... :)
You can look the code its very simple just creation of checkbox followed by creation of label box... for joining purpose.
========== Code Start ================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script lanaguage="JavaScript">
function testonload()
{
var context = document.getElementById("context");
var inputs = new Array();;
var filters = document.createElement('div');
context.appendChild(filters);
var Feedlist = "Alerts,Events,Message";
var feedNames = Feedlist.split(",");
for(i=0; i<feedNames.length; i++){
// Create a unique ID for the checkbox based on the widget ID
var inputID = "KKK" + "-filter-" + feedNames[i];
// Create an input the wacky IE-way
if (document.all) {
var strInput = "<input type='checkbox' id='"+inputID+"' value='"+feedNames[i]+"' checked='checked' />";
inputs[i] = document.createElement(strInput);
}
// Other browsers...
else {
inputs[i] = document.createElement('input');
inputs[i].type = 'checkbox';
inputs[i].id = inputID;
inputs[i].value = feedNames[i];
inputs[i].checked = true;
}
filters.appendChild(inputs[i]);
var label = document.createElement("label");
label.className = "inline";
label.setAttribute("for", inputID);
label.innerHTML = feedNames[i];
filters.appendChild(label);
//YAHOO.util.Event.on(this.inputs[i], 'click', this.updateDataTable, this, true);
}
}
</script>
</head>
<html>
<body onload="testonload()">
<div id="context">
</div>
</body>
</html>
========== Code End =================
Thanks in Advance,
RK