【问题标题】:Datepicker positioning not correctly working日期选择器定位不正确
【发布时间】:2013-09-24 10:54:36
【问题描述】:

我有一个搜索框,用于搜索用户可以使用 jquery 中的日期选择器插件选择的一段时间内的一系列日期。我遇到的问题是启用日期选择器的位置出现在页面的左下角,而不是直接在搜索框下方。我提供了用于 jquery 和 HTML 部分的标记。谁能告诉我如何纠正这个问题?

jQuery:

<script type="text/javascript" src="includes/javascript/daterangepicker.jQuery.js"></script>

<script type="text/javascript"> 
    $(function(){
        if($(window.parent.document).find('iframe').size()){
            var inframe = true;
        }

        $('.datepick').daterangepicker({
            arrows: false, 
            dateFormat: 'dd/mm/yy',
            posX: null,
            posY: null,
            onOpen:function(){ 
                if(inframe){
                    $(window.parent.document).find('iframe:eq(0)').width(700).height('35em');
                } 
            }, 
            onClose: function(){ 
                if(inframe){
                    $(window.parent.document).find('iframe:eq(0)').width('100%').height('5em');
                } 
            }
        }); 

    });
</script>

HTML:

<table border="0" align="right">
    <tr>
        <?php echo tep_draw_form('search_date_purchased', FILENAME_ORDERS, '', 'post'); ?>

        <td class="smallText" align="right">
            <?php echo TEXT_ORDER_DATE;?>
            &nbsp;
            <input type="text" name="search_date_purchased" placeholder="Choose a Date" class="datepick" value="<?php echo $HTTP_POST_VARS['search_date_purchased'];?>">
            &nbsp;
            <input src="./images/Search.png" alt="Search" title="Search" border="0" type="image">
        </td>
    </form>
    </tr>
</table>

【问题讨论】:

  • @panther 我试过你的编辑,但还是一样...
  • Johnny :我没有更改代码,只是为了更好地理解而对其进行了格式化。

标签: javascript php jquery html datepicker


【解决方案1】:

您的 html 无效: 您的 html 中有一个结束表单标记。您还尝试在 tr 标记内回显某些内容,这不是有效的 html。您需要在 td 标记内回显。

<table border="0" align="right">
     <tr>
       <td><?php echo tep_draw_form('search_date_purchased', FILENAME_ORDERS, '', 'post'); ?></td>
       <td class="smallText" align="right"><?php echo TEXT_ORDER_DATE;?>&nbsp;<input type="text" name="search_date_purchased" placeholder="Choose a Date" class="datepick" value="<?php echo $HTTP_POST_VARS['search_date_purchased'];?>">&nbsp;<input src="./images/Search.png" alt="Search" title="Search" border="0" type="image"></td>     
     </tr>
</table>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-19
    • 1970-01-01
    • 1970-01-01
    • 2018-07-20
    • 1970-01-01
    相关资源
    最近更新 更多