I can't get a javascript inline function call to work. The inline function is this:
<span> <input type="button" value="Previous Week" onClick="subtractOneWeekReloadPage()">
I have the function that should be called written into the header as follows:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Time Tracking Page</title>
<script type="text/javascript">
function subtractOneWeekReloadPage() {
<%=currentWeek.subtractOneWeek()%>;
window.location.reload();}
</script>
</head>
When I click on the button on the web page nothing happens though. Neither my jsp call nor the page refresh call is running. Can anyone tell me what I'm doing wrong please?
The relevant output of the page is:
<span>
<input type="button" value="Previous Week" onClick="subtractOneWeekReloadPage()">
Hours for the week of
<%=currentWeek.firstDayOfThisWeek()%>
until
<%=currentWeek.lastDayOfThisWeek()%>
<input type="button" value="Next Week" onClick="addOneWeekReloadPage()">
</span>
The jsp calls to display the first and last days of the week are working fine. But when I click to subtract one week and reload the page with the newly set week, nothing is happening.
<%=currentWeek.subtractOneWeek()%>;do?