Wednesday, May 11, 2011

Javascript

1. Closing the parent window and opening a new child window

<a href="javascript:window.open('', '_self', ''); window.close();window.open('HTMLPage.htm', '', 'width:200');">Checking</a>

for checking and unchecking the all the checkboxes in the gridview or radgrid(telerik)


function checkAll(fld) {

var flag=false;
if (fld.checked) {
flag=true;
}

var frm = document.forms[0];
var j = 0;
for (i = 0; i < frm.elements.length; i++) {

if (frm.elements[i].type == "checkbox") {
//chkCheckAll is the checkbox sits at the top and select or deselect other controls
if(frm.elements[i].id != 'chkCheckAll') {
frm.elements[i].checked = flag;
}

}


}

}