Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Sunday, November 29, 2009

How to refresh a page using javascript

< a href="javascript:location.reload(true)" >Refresh this page< /a >

How to return a value of a radio button in a group

Use the following function to get the value of the selected radio button in a group.

function checkRadio (frmName, radiobuttonGroupName) {
var radios = document[frmName].elements[radiobuttonGroupName];
for (var i=0; i < radios.length; i++) {
if (radios[i].checked) {
return radios[i].value;
}
}
return false;
}

selected = checkRadio (frmName, radiobuttonGroupName);

How to load values from popup window to parent window

opener.document.getElementById("parenttxtName").value = document.getElementById("popuptxtname").value;

Friday, September 18, 2009

How to refresh a page using Javascript

Use the following method to refresh a page...

<a href="javascript:location.reload(true)">Refresh this page</a>

How to access parent window element in Javascript

Use the following code to fill a parent window element from child window.

opener.document.getElementById("parentname").value = document.getElementById("childname").value;