execute js when page loaded code example
Example 1: js on page loaded
window.onload = function() {
yourFunction(param1, param2);
};
Example 2: javascript execute code on page load
<html>
<body onload="loaded();"></body>
<script>
function loaded() {
alert('Page is loaded');
}
</script>
</html>