jsp代碼:
<form action="" method="post">
<table>
<tr>
<td>開始時間</td><td><input type="text" name="start" id="start" value="https://bbs.csdn.net/topics/<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) %>" onclick="main('start')" ></td>
<td>結束時間</td><td><input type="text" name="end" id="end" value="https://bbs.csdn.net/topics/<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) %>" onclick="main('end')"></td>
<td><input type="submit" name="chaxun" value="https://bbs.csdn.net/topics/查詢"></td>
</tr>
</table>
<p onclick="prevMonth()"><<</p>
<div id="div1"></div>
<div id="div2"}></div>
</form>
js源代碼存盤在calendar.js
function main(source){
getCurrentDate();
var strFrame='<table class=mt id=mt>';
strFrame+='<tr>';
strFrame+='<td>';
strFrame+="<p onclick=\"prevMonth()\">";
strFrame+='<<';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td colspan=5>';
strFrame+='<p>';
strFrame+=now.getFullYear()+'年'+(now.getMonth()+1)+'月';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+="<p onclick=\"nextMonth()\">";
strFrame+='>>';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='</tr>';
strFrame+='<tr>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='日';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='一';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='二';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='三';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='四';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='五';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='<td>';
strFrame+='<p>';
strFrame+='六';
strFrame+='</p>';
strFrame+='</td>';
strFrame+='</tr>';
strFrame+='</table>';
//var div1=document.getElementById("div1");
var div2=document.getElementById("div2");
if(source=='start'){
div1.innerHTML=strFrame;
div2.innerHTML="";
}else{
div2.innerHTML=strFrame;
div1.innerHTML="";
}
}
function prevMonth(){
alert("a");
}
uj5u.com熱心網友回復:
又莫名其妙的能執行了,這是什么鬼uj5u.com熱心網友回復:
div2里可以正常執行,div1里無法執行,高手在哪里?能解釋一下嗎
uj5u.com熱心網友回復:
不能執行的時候,打開控制臺,看看有沒有什么報錯提示,估計是資料格式問題
uj5u.com熱心網友回復:
div2 多了個}
uj5u.com熱心網友回復:
刪了,一樣還是老問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/284361.html
標籤:JavaScript
下一篇:VM
