在JSP中使用jQuery Datepicker [英] Using jQuery Datepicker in a JSP
本文介绍了在JSP中使用jQuery Datepicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是jsp代码.
<head>
<link rel="stylesheet" type="text/css" href="<%=contextPath %>/style_sheet/page_header.css" >
<link href="<%=contextPath %>/scripts/jQuery/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="<%=contextPath %>/scripts/jQuery/jquery.min.js" ></script>
<script src="<%=contextPath %>/scripts/jQuery/jquery-ui.min.js"></script>
<script src="jscript.js" ></script>
<style>
.pageWidth
{
width: 800px;
}
</style>
<script>
$(document).ready(function(){
$("#startDatePicker").datepicker();
});
</script>
<title>GFW Voice OUT Files Trend</title>
</head>
<body>
<table width="800x" border="0" align="center">
<tr>
<td>Start Date: <input type="text" id="startDatePicker" /></td>
</tr>
</table>
</body>
语法错误
$(document).ready(function(){
$("#startDatePicker").datepicker();
});
错误
The function $(HTMLDocument) is undefined.
我虽然eclipse在EL和jQuery语法之间变得混乱,但是使用\ $却无济于事. 我究竟做错了什么?我要做的就是使用jQuery datepicker.
I though eclipse is getting confused between EL and jQuery syntax, but using \$ did not help. what am I doing wrong? All I want to do is use jQuery datepicker.
推荐答案
jquery文件未正确安装.使用该代码完成其工作.
jquery file is not installed correctly. Use that code its work.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<title>Test</title>
</head>
<body>
Date: <input type="text" id="datepicker" />
</body>
</html>
这篇关于在JSP中使用jQuery Datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文