2013-09-30 85 views
0

我是web開發的初學者,任何人都可以幫助我,並將其轉換成ASP.net中的HTML,我試圖使用這個jQuery,但我無法使用它。 http://tarruda.github.io/bootstrap-datetimepicker/在Asp.net中實現HTML轉換,實現jquery

<div class="well"> 
    <div id="datetimepicker2" class="input-append"> 
    <input data-format="MM/dd/yyyy HH:mm:ss PP" type="text"></input> 
    <span class="add-on"> 
     <i data-time-icon="icon-time" data-date-icon="icon-calendar"> 
     </i> 
    </span> 
    </div> 
</div> 
<script type="text/javascript"> 
    $(function() { 
    $('#datetimepicker2').datetimepicker({ 
     language: 'en', 
     pick12HourFormat: true 
    }); 
    }); 
</script> 
+0

您是否已經導入了jquery腳本.js文件和插件bootstrap-datetimepicker .js文件?你能告訴我們完整的HTML包括頭標嗎? – Mortalus

回答

1

請確保您沒有錯過任何css或腳本引用。

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <script type="text/javascript" 
    src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"> 
    </script> 
     <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> 
    <link rel="stylesheet" type="text/css" media="screen" 
    href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css"> 
    <link href="bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" /> 
    <script type="text/javascript"> 
     $(function() { 
      $('#datetimepicker2').datetimepicker({ 
       language: 'en', 
       pick12HourFormat: true 
      }); 
     }); 
</script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <div class="well"> 
    <div id="datetimepicker2" class="input-append"> 
    <input data-format="MM/dd/yyyy HH:mm:ss PP" type="text"></input> 
    <span class="add-on"> 
     <i data-time-icon="icon-time" data-date-icon="icon-calendar"> 
     </i> 
    </span> 
    </div> 
</div> 
    </div> 
    </form> 
</body> 
</html> 
+0

你能否將身體轉換成asp:textbox,以便我可以將數據收集到.cs文件中。 – RookieRoll

+0

您不能使用服務器端控件來操作日期時間選擇器。嘗試使用隱藏字段: 或發佈你的例子,所以我可以幫助你更好。 – tilda

0

檢查您是否缺少任何css或js引用。以下是他們擁有的示例將會包含所有必需的組件。

<!DOCTYPE HTML> 
<html> 
    <head> 
    <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> 
    <link rel="stylesheet" type="text/css" media="screen" 
    href="http://tarruda.github.com/bootstrap-datetimepicker/assets/css/bootstrap-datetimepicker.min.css"> 
    </head> 
    <body> 
    <div id="datetimepicker" class="input-append date"> 
     <input type="text"></input> 
     <span class="add-on"> 
     <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i> 
     </span> 
    </div> 
    <script type="text/javascript" 
    src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.min.js"> 
    </script> 
    <script type="text/javascript" 
    src="http://tarruda.github.com/bootstrap-datetimepicker/assets/js/bootstrap-datetimepicker.pt-BR.js"> 
    </script> 
    <script type="text/javascript"> 
     $('#datetimepicker').datetimepicker({ 
     format: 'dd/MM/yyyy hh:mm:ss', 
     language: 'pt-BR' 
     }); 
    </script> 
    </body> 
<html>