java - javascript function not getting executed -


i want execute javascript function in external js file when page loaded. code in jsp file function called from, placed @ bottom of jsp

<%-- begins countdown --%> <script src="/pub/scripts/counter.js" type="text/javascript"></script> <script type="text/javascript"> window.onload=startcountdown; </script> 

this function in js file

function startcountdown() { var timeout = 900000;  var count_back = 3;    settimeout("displaywarning("+count_back+")", timeout); } 

when page loads in browser see script loaded startcountdown function never gets executed. how can make work?

i use <body onload="startcountdown()"> in html ensure page must load before executing script.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -