$(..)DatePicker在控制台中不是函数错误

时间:2013-12-04 06:19:00

标签: javascript jquery ajax jsp datepicker

enter image description here这是我的孩子jsp,它将被替换为Master页面,看到这整个代码 `

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.angelcam.dao.UserMethod"%>
<%@page import="com.angelcam.domain.UserWS"%>



<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    System.out.println("view details page called *****  ");
    System.out.println("view details page called *****  ");
    int id = Integer.parseInt(request.getParameter("id"));

    List<UserWS> list = new UserMethod().getUser(id);

    UserWS userWS = list.get(0);
%>


<link rel="stylesheet"
            href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
        <script src="http://code.jquery.com/jquery-1.9.1.js">
</script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">
</script>

<!--<script type="text/javascript" src="js/jtabber.js">
</script>
<script type="text/javascript" src="js/angelcamapp.js">
</script>

-->
<!--<link href="css/style.css" rel="stylesheet" type="text/css" />

-->
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(function() {
    $j("#datepicker").datepicker();
});
</script>


<form name="updateuser" action="UpdateUser" method="post" onsubmit="">

    <input type="hidden" name="id" value="<%=request.getParameter("id")%>">

    <div id="table">
        <div id="row">
            <div id="col1">
                First Name
            </div>
            <div>
                <input type="text" name="firstname" id="firstname"
                    value="<%=userWS.getFirstname()%>" class="inputtext" />
            </div>
        </div>

        <div id="row">
            <div id="col1">
                Last Name
            </div>
            <div id="col2">
                <input type="text" name="lastname" id="lastname" class="inputtext"
                    value="<%=userWS.getLastname()%>" />
            </div>
        </div>

        <div id="row">
            <div id="col1">
                Email
            </div>
            <div id="col2">
                <input type="text" readonly name="email" id="email"
                    class="inputtext" value="<%=userWS.getEmail()%>" />
            </div>
        </div>

        <div id="row">
            <div id="col1">
                DOB
            </div>
            <div id="col2">

                <input type="text" id="datepicker" />

            </div>
        </div>

        <div id="row">
            <div id="col1">
                Gender
            </div>
            <div id="col2">
                <%
                    if (userWS.getGender().equalsIgnoreCase("Male")) {
                %>
                <input type="radio" name="radio" value="Male" id="Male"
                    checked="checked" />
                Male
                <input type="radio" name="radio" value="Female" id="Female" />
                Female
                <%
                    } else {
                %>
                <input type="radio" name="radio" value="Male" id="Male" />
                Male
                <input type="radio" name="radio" value="Female" id="Female"
                    checked="checked" />
                Female

                <%
                    }
                %>
            </div>
        </div>

        <div id="row">
            <div id="col1">
                Password
            </div>
            <div id="col2">
                <input type="text" name="password" id="password" class="inputtext"
                    value="<%=userWS.getPassword()%>" />
            </div>
        </div>

        <div id="row">
            <div id="col1">
                Confirm Password
            </div>
            <div id="col2">
                <input type="text" name="confirmpassword" id="confirmpassword"
                    class="inputtext" value="<%=userWS.getPassword()%>" />
            </div>
        </div>

        <div id="row">
            <div id="col1">
                Status
            </div>
            <div id="col2">
                <%
                    if (userWS.isActiveflag()) {
                %>
                <input type="checkbox" name="status" id="status" checked="checked" />

                <%
                    } else {
                %>
                <input type="checkbox" name="status" id="status" />
                <%
                    }
                %>
            </div>
        </div>

        <div id="row">
            <div id="col1">
                &nbsp;
            </div>
            <div id="col2">
                <input type="submit" id="button" value="Save" />
            </div>
        </div>

    </div>
</form>
`![enter image description here][2]Hello i am using one Java Script date picker and i am using Ajax too in that. means to Replace Div into Master page.

Here i am using one Java Script Calender Control into the Child Jsp means which is Replacing threw Ajax into the Master Page here my Code is.

    <html>
       <head>
        <link rel="stylesheet"
        href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js">
       </script>
      <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">
      </script>

      <script>
    $(function() {
        $("#datepicker").datepicker();
    });
    </script>


      </head>

    <body>
    <div id="row">
                <div id="col1">
                    DOB
                </div>
                <div id="col2">

                    <input type="text" id="datepicker" />

                </div>
            </div>

    </body>

    </html>

我试图在母版页中也这样做,但它给出了同样的错误。表示父页面和子页面存在问题。 可能存在冲突错误bcoz我也在使用其他JavaScript库所以我不知道真正的问题是什么。 因为我尝试将它分开并且工作正常。 请帮我解决这个问题。 提前感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

您是否尝试过使用noConlict选项? jQuery.noConflict Documentation

答案 1 :(得分:1)

试试这个:

<script>
  var $j = jQuery.noConflict();
  $j(function() {
    $j( "#datepicker" ).datepicker();
  });
</script>