2010-05-26 89 views
1

我想在我的应用程序中显示基本的jQuery datepicker。当用户点击输入字段时,会显示一个日历。当日历弹出时,我的输入字段位于窗口的底部。它在Firefox和Chrome(在输入字段之上)中显示得很好,但在IE中不显示(在输入字段下方弹出并且压光机在IE底部被切断)。我想知道这里有人能帮助我。非常感谢!jQuery UI datepicker问题

样品

alt text http://www.parkerandassociates.org/jquery.JPG

我的jQuery:

$("#addMatch").live('click', function(){ 

$(this).closest('tr').before("<//input field #datepicker 
"<tr><td>Date: <input type='text' id='datepicker' size='6' name='date'></td>"+ 
"<td colspan='3'>Time: <select><option>13:00</option>"+ 
      "<option>18:00</option>"+ 
      "<option>19:00</option>"+ 
      "<option>20:00</option>"+ 
      "</select></td>"+ 
      "</tr>"); 

$("#datepicker").datepicker({ changeMonth: true, changeYear: true, yearRange: '2010:2020'}); 

return false; 
}); 
+1

后的代码中发现? :-) – 2010-05-26 20:26:33

+0

您是否在发布的代码中缺少'',或者是否在那里插入了无效的html(例如未打开的行)? – 2010-05-26 20:38:26

+0

谢谢你指出尼克。我只在这里粘贴了我的html代码的一部分。我的文件中的html很好。 – FlyingCat 2010-05-26 20:49:46

回答

0

也许你应该尝试用.offset()功能修复它。

然后向下滚动页面一些像素,这样你就可以确定所有的日历都显示出来了。

退房的例子上this website

<div id="scrollToHere"> 
Scroll to here 
</div> 

You need something to run your script. Create a button like this: 

<input type="button" onclick="scollWin();" value="Scroll up" /> 

The jQuery Code will be like this: 

function scrollWin(){ 
    $('html,body').animate({ 
     scrollTop: $("#scrollToHere").offset().top 
    }, 2000); 
}