Table of Contents [Hide/Show]
Navigating Reloading Displaying the current URL Displaying the Document Timestamp Setting Initial Focus Submitting a Form Applying Alternating Formats to a Table AjaxReloadElement Function Showing the Print Dialog Highlight Flash Timer Delayed Function Call Recurring Function Call
window.location.href = '...';
location.reload(); // reload from cache location.reload(false); // reload from cache location.reload(true); // reload from server
document.write(document.URL);
document.write(document.lastModified);
document.getElementById("myControlId").focus();
document.forms[0].submit();
even
odd
function recolorTable() { var rows = '#MyTable tbody tr' $(rows).removeClass('even').removeClass('odd'); $(rows + ':visible:even').addClass('even'); $(rows + ':visible:odd').addClass('odd'); }
function ajaxReloadElement(url, data, targetSelector, httpMethod) { if (httpMethod == undefined || httpMethod == null) { httpMethod = 'GET'; } $.ajax({ type: httpMethod, url: url, async: false, datatype: 'json', data: data, success: function (response) { $(targetSelector).html(response); } /* success */ }); /* ajax */ }
window.print();
selector
function highlightFlash(selector) { $(selector).show(); $(selector).css('background-color', '#FFFF00'); setTimeout(function () { $(selector).css('background-color', '#FFFFFF'); }, 1000); }
setTimeout("myFunction", ms);
setTimeout(function(){ /* do something */ }, ms);
var x = setInterval("myFunction", ms); . . . clearInterval(x);
var x = setInterval(function(){ /* do something */ }, ms); . . . clearInterval(x);