单击按钮时未填充 Jquery Datepicker?

发布于 2024-12-01 04:13:52 字数 1631 浏览 0 评论 0原文

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <link type="text/css" href="Styles/Site.css" rel="Stylesheet" ></link >
   <script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

</head>
<body>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var textBox = $('#mdatepicker');
            var icon = $('#myButton');
            var mydatepicker = textBox.datepicker();

            icon.click(function () {
                mydatepicker.datepicker("show");
            });

        });
    </script>;

    <form id="form1" runat="server">
            <input type="text" id="mdatepicker"  value="date" />
            <input type="button" id="myButton"   value="PopUp"/>
    </form>
</body>
</html>

这个 html 片段中是否缺少任何内容??

datepicker 未填充,ErrorConsole 显示错误 -

'textBox.datepicker is not a function'

在下面的代码中;

var mydatepicker = var mydatepicker = textBox.datepicker();

有人可以帮忙吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <link type="text/css" href="Styles/Site.css" rel="Stylesheet" ></link >
   <script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

</head>
<body>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var textBox = $('#mdatepicker');
            var icon = $('#myButton');
            var mydatepicker = textBox.datepicker();

            icon.click(function () {
                mydatepicker.datepicker("show");
            });

        });
    </script>;

    <form id="form1" runat="server">
            <input type="text" id="mdatepicker"  value="date" />
            <input type="button" id="myButton"   value="PopUp"/>
    </form>
</body>
</html>

Is there anything missing in this html snippet .??

datepicker is not getting populated, ErrorConsole showing error that-

'textBox.datepicker is not a function'

in below code;

var mydatepicker = var mydatepicker = textBox.datepicker();

Can someone help please.?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

纵山崖 2024-12-08 04:13:52

这是我的代码的工作副本。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link type="text/css" href="Styles/Site.css" rel="Stylesheet" ></link >
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

</head>
<body>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        var textBox = $('#mdatepicker');
        var icon = $('#myButton');
        var mydatepicker = textBox.datepicker();

        icon.click(function () {
            mydatepicker.datepicker("show");
        });

    });
</script>;

<form id="form1" runat="server">
        <input type="text" id="mdatepicker"  value="date" />
        <input type="button" id="myButton"   value="PopUp"/>
</form>

Thats my working copy of your code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link type="text/css" href="Styles/Site.css" rel="Stylesheet" ></link >
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

</head>
<body>
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        var textBox = $('#mdatepicker');
        var icon = $('#myButton');
        var mydatepicker = textBox.datepicker();

        icon.click(function () {
            mydatepicker.datepicker("show");
        });

    });
</script>;

<form id="form1" runat="server">
        <input type="text" id="mdatepicker"  value="date" />
        <input type="button" id="myButton"   value="PopUp"/>
</form>

夏九 2024-12-08 04:13:52

datepicker 不是 jQuery-UI 库中的函数吗?

如果是这样,那么您需要包含对 jQuery-UI 库的脚本引用。

编辑

否 您需要添加对 jQuery-UI 库和 jQuery-UI Css 文件的脚本引用

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="src of desired theme" />

Is datepicker not a function from the jQuery-UI library?

If so, then you need to include a script reference to the jQuery-UI Library.

EDITS

No You need to add a script reference to the jQuery-UI library and jQuery-UI Css file

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="src of desired theme" />
八巷 2024-12-08 04:13:52

您是否提供了 js 文件的完整参考?包括jquery和datepicker的.js文件。

问题在于:

   <script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>

我在您的 head 标记中看不到任何有关 datepicker 的 js 文件,其中您已包含所有 js 引用。

必须有一些文件,如:

<script type="text/javascript" src="Scripts/datepicker.js"></script>

或类似的文件,您缺少包含这些文件。

希望这有帮助。

Are you giving full refrences to js files. Including jquery and datepicker's .js files.

The issue is in this:

   <script type="text/javascript" src="Scripts/jquery-1.4.1-vsdoc.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
   <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>

I can not see any js files regarding datepicker in your head tag where you've included all js refrences.

There must be some file like:

<script type="text/javascript" src="Scripts/datepicker.js"></script>

or something like that, which you are missing to include.

Hope this helps.

挽清梦 2024-12-08 04:13:52

如果你使用jquery datepicker,'myButton'对象不是必需的,datepicker会处理它以供使用,请参阅代码:

<html>
<head><title>jQuery Open on button</title>
<link rel="stylesheet" href="ui.all.css" type="text/css" media="screen" />

</head>
<body>
<form>
    <input id="date" type="textbox"/>
</form>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
                $("#date").datepicker({ showOn: 'button', buttonText: "select" });
        });
    </script>

</body>
</html>

if you use jquery datepicker, the 'myButton' object is not necessary, datepicker will handle it for use, see the code:

<html>
<head><title>jQuery Open on button</title>
<link rel="stylesheet" href="ui.all.css" type="text/css" media="screen" />

</head>
<body>
<form>
    <input id="date" type="textbox"/>
</form>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.3/jquery-ui.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
                $("#date").datepicker({ showOn: 'button', buttonText: "select" });
        });
    </script>

</body>
</html>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文