Here is A.jsp
<script>
function showSpOnLoad()
{
//all of ajax code
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("ajaxData").innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET",'B.jsp?date='+date+'',true);
}
</script>
<body>
<span class="inner-link-text2" id="sp" style="cursor:pointer" onclick="showSpOnLoad()">My Stats</span>
<div id="ajaxData" align="center"></div>
</body>
here in A.jsp,you can see that on clicking Span My Stats , I am just calling a js function showSpOnLoad() will open another jsp page which is B.jsp in a div ajaxData.
Now in B.jsp , I have just a scriplet showing a text field,a link and a button. Here is B.jsp
<%
String output = "";
output += "<input name='date' type='text' id='date' value=''style='margin-left=10px;'/>";
output += "<a href='#' ><img src='images/img.gif' border='0' id='cal_img' ></a>";
output += "<input type='submit' value='Generate Stats' onclick='getVal();'/>";
%>
<%= output %>
<link href="js/calendar-blue.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/calendar-en.js"></script>
<script type="text/javascript" src="js/calendar-setup.js"></script>
<script type="text/javascript">
Calendar.setup({
inputField : "date", // id of the input field
ifFormat : "%Y-%m-%d", // format of the input field
button : "cal_img", // trigger for the calendar (button ID)
singleClick : true
});
</script>
This page is showing fine but as you can see , I have attached a calendar with the textfield on <a href>.
Now the problem is that when I click on this link, it never shows the calendar.
I have placed this calendar js in A.jsp but it also never work there.Now I am unable to understand the issue.
Any suggestions from experts?