與this question包括使用HTML網頁頁面時jQuery的不工作包括:
參考我們有一個日期頭拾取組件(jQuery和CSS)。當單獨存在標題時,日期選擇器可以正常工作。當我嘗試使用此標題將另一個頁面包含爲主體時,日期選擇器不起作用。
我們使用this link
提到當我們有另一個頁面上面提到的代碼的日期選擇器,日期挑不工作。
包括我使用的命令。 <%@ include file="enterClarity.jsp" %>
有一些表單驗證Java腳本,這是目前在enterCalrity.jsp頁
編輯:
單獨
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/calendar.css" type="text/css" />
<link rel="stylesheet" href="../css/datepicker_comp_1.css" type="text/css"/>
<link rel="stylesheet" href="../css/datepicker_comp_2.css" type="text/css"/>
<script type="text/javascript" src="../js/datepickr.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function(){
jQuery("#datepicker").datepicker();
});
</script>
<title>Clarity</title>
</head>
<body>
<form id="clarityaction" name="tstest" onsubmit="return true;" action="/metrix/clarityaction.action" method="post"><table class="wwFormTable">
<table width="100%" border="0" style="height: 616px; width: 1260px;"
cellpadding="0" cellspacing="0">
<tr class="header">
<td align="right" valign="bottom">
<B>Welcome Karthik Prabhu D </B>
</td>
</tr>
<tr class="header">
<td align="right" valign="top">your last login was : 2012-06-16 15:33:51.0
</td>
</tr>
<tr align="left" valign="bottom"><td>
<input type="text" id="datepicker" class="haspicker" /></td></tr>
<tr>
<td bgcolor="#FFFFFF" height="70%" width="100%">
<table width="60%" border="0" style="height: 430px; width: 1206px;"
cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0"style="vertical-align: top" cellpadding="0" cellspacing="0">
<tr>
<td>
</td>
</tr>
</table></td>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="footer"></td>
</tr>
</table>
</table></form>
</body>
</html>
頭包含頁面後:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/calendar.css" type="text/css" />
<link rel="stylesheet" href="../css/datepicker_comp_1.css" type="text/css"/>
<link rel="stylesheet" href="../css/datepicker_comp_2.css" type="text/css"/>
<script type="text/javascript" src="../js/datepickr.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript" charset="utf-8">
jQuery(function(){
jQuery("#datepicker").datepicker();
});
</script>
<title>Clarity</title>
</head>
<body>
<form id="clarityaction" name="tstest" onsubmit="return true;" action="/metrix/clarityaction.action" method="post"><table class="wwFormTable">
<table width="100%" border="0" style="height: 616px; width: 1260px;"
cellpadding="0" cellspacing="0">
<tr class="header">
<td align="right" valign="bottom">
<B>Welcome Karthik Prabhu D </B>
</td>
</tr>
<tr class="header">
<td align="right" valign="top">your last login was : 2012-06-16 15:36:10.0
</td>
</tr>
<tr align="left" valign="bottom"><td>
<input type="text" id="datepicker" class="haspicker" /></td></tr>
<tr>
<td bgcolor="#FFFFFF" height="70%" width="100%">
<table width="60%" border="0" style="height: 430px; width: 1206px;"
cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table border="0"style="vertical-align: top" cellpadding="0" cellspacing="0">
<tr>
<td>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../js/tabing.js"></script>
<script type="text/javascript" src="../js/tabjs.js"></script>
<script type="text/javascript" src="../js/validaionjs.js"></script>
<link rel="stylesheet" href="../css/tabStyle.css" type="text/css" />
</head>
<body>
<-- Other page contents -->
</body>
</html>
你可以給最終的HTML出現?也許jsp文件中的某些js會導致錯誤。 – avk
_header與選取的日期_請解釋? – Baz1nga
也請出示你的代碼,最好我已經編輯後生成的標記 – Baz1nga