English 中文(简体)
执行JQuery 日期picker
原标题:Implementing JQuery Datepicker

我想执行J Query 日期picker。 我在我的《共同未来论坛法》中补充了 Java本。 这是超文本产出:

<?xml version= 1.0  encoding= UTF-8  ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
            <title>DX-57 History Center</title>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <link rel="shortcut icon" type="image/x-icon" href="resources/css/themes/nvidia.com/images/favicon.ico" />
            <link href="resources/css/helper.css" media="screen" rel="stylesheet" type="text/css" />
            <link href="resources/css/dropdown.css" media="screen" rel="stylesheet" type="text/css" />
            <link href="resources/css/default.advanced.css" media="screen" rel="stylesheet" type="text/css" />

            <script type="text/javascript" src="resources/js/jquery-1.7.2.min.js"></script>
            <script type="text/javascript" src="resources/js/jquery-ui-1.8.18.custom.min.js"></script>
            <link href="resources/css/jquery-ui-1.8.18.custom.css" media="screen" rel="stylesheet" type="text/css" />
            <script type="text/javascript" src="resources/js/tabs.js"></script>
        <script type="text/javascript">
            $(function(){                                
                // Datepicker
                $( #datepicker ).datepicker({
                    inline: true,
                    showWeek: true,
                    firstDay: 1
                });
            });            
        </script><script type="text/javascript" src="/test/javax.faces.resource/jsf.js.jsf?ln=javax.faces&amp;stage=Development"></script></head><body>
        <!-- demo inset for with validator -->
        <h1><img src="resources/css/images/icon.png" alt="NVIDIA.com" /> History Center</h1>
        <!-- layer for black background of the buttons -->
        <div id="toolbar" style="margin: 0 auto; width:1180px; height:30px; position:relative;  background-color:black">
            <!-- Include page Navigation -->
            <ul class="dropdown dropdown-horizontal" style="margin: 0 auto">
                <li><a href="/SR_57-1.0-SNAPSHOT/UserNav.jsf" class="dir">Home</a>
                    <ul>
                        <li><a href="Dashboard.jsf">Dashboard</a></li>
                    </ul>       
                </li>
                <li><a href="Sessions.jsf" class="dir">Sessions</a>
                </li>
                <li><a href="Application.jsf" class="dir">Application</a>
                    <ul>                
                        <li><a href="Glassfish.jsf">Glassfish</a></li>
                    </ul>
                </li>
                <li><a href="Linux.jsf" class="dir">Linux</a>                   
                </li>
                <li><a href="Database.jsf" class="dir">Database</a> 
                    <ul>                
                        <li><a href="History.jsf">History</a></li>
                    </ul>
                </li>                   
            </ul>          

        </div>  

        <div id="logodiv" style="position:relative; top:35px; left:0px;"><img src="resources/images/logo_databasez.png" alt="Demo Insert Form" style="position:relative; top:-20px; left:9px;" />
        </div>
        <div id="main" style="margin: 0 auto; width:1190px; height:700px; position:absolute;  background-color:transparent; top:105px">

            <div id="mainpage" style="margin: 0 auto; width:1190px; height:500px; position:absolute;  background-color:transparent; top:80px">

                <div id="settingsHashMap" style="width:350px; height:400px; position:absolute;  background-color:r; top:20px; left:1px">
<form id="j_idt13" name="j_idt13" method="post" action="/test/Database.jsf" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt13" value="j_idt13" />

                        <div id="settingsdiv" style="width:750px; height:400px; position:absolute;  background-color:r; top:20px; left:1px"><table>
<tbody>
<tr>
<td>Session ID</td>
<td><input id="j_idt13:sessionid" type="text" name="j_idt13:sessionid" onblur="mojarra.ab(this,event, blur ,0, j_idt13:sessionidMessage )" /><span id="j_idt13:sessionidMessage"></span></td>
</tr>
<tr>
<td>Date</td>
<td><input id="j_idt13:datepicker" type="text" name="j_idt13:datepicker" /></td>
</tr>
<tr>
<td>Login Time</td>
<td><input id="j_idt13:logintime" type="text" name="j_idt13:logintime" /></td>
</tr>
<tr>
<td>Last Refresh Time</td>
<td><input id="j_idt13:lastrefreshtime" type="text" name="j_idt13:lastrefreshtime" /></td>
</tr>
<tr>
<td>User IP</td>
<td><input id="j_idt13:userip" type="text" name="j_idt13:userip" /></td>
</tr>
</tbody>
</table>


                        </div>   

                        <div id="settingstwodiv" style="width:150px; height:60px; position:absolute;  background-color:transparent; top:380px; left:800px"><input type="submit" name="j_idt13:j_idt32" value="Create User" />

                        </div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="7591771537138283258:6254434046150824528" autocomplete="off" />
</form> 

                </div>   

            </div>  
        </div></body>
</html>

但是,当我点击呈文时,没有发生任何情况。 是否有任何失踪? 例如,我发现日历使用的是<代码><div id=“datepicker”></div>。 我以我的榜样利用投入。

Best Wishes

http://www.ohchr.org。

我添加了<条码>div,只视日历。

页: 1 这里:

<h:panelGrid columns="2">
                                <h:panelGroup>Session ID</h:panelGroup>
                                <h:panelGroup>
                                    <h:inputText id="sessionid" value="#{DatabaseController.formMap[ sessionid ]}" 
                                                 validator="#{ValidatorController.validatebean}">                                        
                                        <f:ajax event="blur" render="sessionidMessage" />                                          
                                    </h:inputText>
                                    <h:message id="sessionidMessage" for="sessionid" />
                                </h:panelGroup>

                                <h:panelGroup>Date</h:panelGroup>
                                <h:panelGroup>
                                     <div id="datepicker"></div>
                                    <h:inputText id="datepicker" value="#{DatabaseController.formMap[ userid ]}" >                                       
                                    </h:inputText>
                                </h:panelGroup>

                                <h:panelGroup>Login Time</h:panelGroup>
                                <h:panelGroup>
                                    <h:inputText id="logintime" value="#{DatabaseController.formMap[ logintime ]}" >
                                        <f:validateLength minimum="0" maximum="35"/>
                                    </h:inputText>
                                </h:panelGroup>

                                <h:panelGroup>Last Refresh Time</h:panelGroup>
                                <h:panelGroup>
                                    <h:inputText id="lastrefreshtime" value="#{DatabaseController.formMap[ lastrefreshtime ]}" >
                                        <f:validateLength minimum="0" maximum="35"/>
                                    </h:inputText>
                                </h:panelGroup>

                                <h:panelGroup>User IP</h:panelGroup>
                                <h:panelGroup>
                                    <h:inputText id="userip" value="#{DatabaseController.formMap[ userip ]}" >
                                        <f:validateLength minimum="0" maximum="15"/>
                                    </h:inputText>
                                </h:panelGroup>

                            </h:panelGrid> 

enter image description here

我愿宣布这样的日历:here。 - 当我点击投入领域时。

似乎还有其他办法将日历列入共同基金。

EDIT 2

Java是否正确?

function calendar(){                                
    // Datepicker
    datepicker({
        inline: true,
        showWeek: true,
        firstDay: 1
    });
}

我将把它称作这一法典:

<h:inputText onclick="calendar" value="#{DatabaseController.formMap[ userid ]}" > 
最佳回答

具体来说,是共同基金。 页: 1 JS.

问题回答

此处忽略了日期pi。 你们叫错。 如上所示,你使用斜坡法使用。

$(function(){
    $( #j_idt13\:datepicker ).datepicker({
        inline: true,
        showWeek: true,
        firstDay: 1
    });
});    

You need to make "#datepicker" the ID of the input box.

e.g.

        $(function(){                                
            // Datepicker
            $( #j_idt13:datepicker ).datepicker({
                inline: true,
                showWeek: true,
                firstDay: 1
            });
        }); 

页: 1

HIya Demo http://jsfiddle.net/8Hp26/

你们的补贴与你一样使用某种模板或用户控制器生成html,因为我增加了一个新类别 = foo,或者你可以尝试和逃脱<代码>:。

<><>> 用于使用越狱添加<条码>:,但添加舱面应当照亮所示。

希望这一帮助。

<<>条码>

 $(function(){                                
            // Datepicker
          //  $( #datepicker ).datepicker({
         $( .foo ).datepicker({                
                inline: true,
                showWeek: true,
                firstDay: 1
            });
        });​
 <script type="text/javascript">
            $(function(){                                
                // Datepicker
                $( #j_idt13:logintime ).datepicker({
                    inline: true,
                    showWeek: true,
                    firstDay: 1
                });
            });            
        </script>

Change it to this. Your selector was wrong.

The id of your input field is not datepicker but j_idt13:datepicker. You have to use this id when calling the datepicker component:

$(function(){
    $( #j_idt13\:datepicker ).datepicker({
        inline: true,
        showWeek: true,
        firstDay: 1
    });
});          

<代码/>为 escaping:,因其为 j。

不过,我建议使用<><>无<>/>><代码>:。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签