簡體   English   中英

Internet Explorer中數據選擇器出錯

[英]Error with datapicker in internet explorer

我在標頭中有以下代碼:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 

在此腳本之后

 <script type="text/javascript">
            jQuery(function($){ //on document.ready
            $('#datePicker').datepicker();
            }); 
        </script> 

在我的HTML中,我使用以下語句:

<input id="datePicker" name="datePicker" type="date" size="36" onkeypress="return postOnReturn(event)">

在Chrome瀏覽器中,我可以看到數據選擇器,但在Internet Explorer中,我只能看到一個空字段。 並在控制台中顯示“未定義JQUEry”的錯誤消息

你知道會發生什么嗎?

謝謝!

我嘗試參考您的步驟以在IE方面解決此問題。 我發現您的代碼在我這方面工作正常,沒有任何錯誤。 這是我的測試結果。

碼:

 <!doctype html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script type="text/javascript"> jQuery(function($){ //on document.ready $('#datePicker').datepicker(); }); </script> </head> <body> <input id="datePicker" name="datePicker" type="date" size="36" onkeypress="return postOnReturn(event)"> </body> </html> 

輸出:

在此處輸入圖片說明

因此我們可以說此示例代碼沒有任何問題,並且在IE中運行良好。 其他代碼行可能有此問題並導致此錯誤。 您可以嘗試再次檢查代碼。

如果您正在使用比我建議的任何舊版本的IE,都建議您轉到IE11。它也可以幫助您解決問題。 我還用各種文檔模式測試了代碼,並且可以正常工作。

您可以嘗試使用我的代碼進行測試,並檢查其是否正常運行。 讓我們知道您的測試結果。

用這種方式

<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<input id="datePicker" name="datePicker" type="text" size="36" onkeypress="return postOnReturn(event)">

https://jsfiddle.net/s2yku8q7/3/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM