小编Ale*_*aho的帖子

如何使用javascript将焦点返回到父窗口?

这不能将焦点返回到Firefox 4和5中的父窗口

<html>
<head>
<script type="text/javascript">
  function openWin()
  {
     myWindow=window.open('','','width=200,height=100');
     myWindow.document.write("<p>The new window.</p>");
     myWindow.blur();
     window.focus();
  }
</script>
</head>
<body>

  <input type="button" value="Open window" onclick="openWin()" />

</body>
</html> 
Run Code Online (Sandbox Code Playgroud)

如何使用javascript将焦点返回到父窗口?

javascript

10
推荐指数
3
解决办法
4万
查看次数

为什么1942/4/3 00:00:00是java.util.Calendar中的非法日期?

1942年4月3日有什么特别的东西吗?出于某种原因,第0天(上午12:00)的小时在此特定日期是非法的.使用宽松日历但一天中的小时增加到1(凌晨1:00)时接受日期.

相关代码

java.util.Calendar calendar = java.util.Calendar.getInstance(
     java.util.TimeZone.getTimeZone("Europe/Helsinki")
);
calendar.clear();
calendar.setLenient(false);
calendar.set(1942, 3, 3, 0, 0, 0);
calendar.getTimeInMillis();
Run Code Online (Sandbox Code Playgroud)

例外

java.lang.IllegalArgumentException: HOUR_OF_DAY
 at java.util.GregorianCalendar.computeTime(Unknown Source)
 at java.util.Calendar.updateTime(Unknown Source)
 at java.util.Calendar.getTimeInMillis(Unknown Source)
Run Code Online (Sandbox Code Playgroud)

我真的更喜欢日期并不宽松,因为我不想接受不可能的日期.

- 编辑

正如公认的答案和许多评论所指出的那样,这确实与夏令时有关.1942年4月3日00:00,在EEST /赫尔辛基时区测试了夏令时.目前,自1981年以来一直在使用夏令时,时钟在03:00而不是00:00前进.这意味着java.util.Calendar中不存在e 2010年3月28日03:00.

我只需要在我的代码中为这个特定日期创建一个特例.

java timezone calendar

4
推荐指数
1
解决办法
1618
查看次数

如何将textarea动态添加到jquery对话框?

我需要将textarea添加到对话框中.如果有任何想法,请建议我.这是我的代码......

var story = changeStory();  
   $.ajax({  
        async: false,  
        type:"GET",  
    data:{"story":story},  
    url: "./teststory.action",  
    dataType: 'json',  
    success: function(json){  
    var i = 0;
    var jsonList = "";  
      $.each(json, function(index,job) {    
        if(i > 0){  
            jsonList = jsonList + ",";  
        }    
        jsonList = jsonList + "[";  
        jsonList = jsonList + "{";  
        ......  
        jsonList = jsonList + "}";   
        jsonList = jsonList + "]";  
        **var newDiv = $(document.createElement('div'));  
        $(newDiv).text();  
        $(newDiv).dialog({modal: true, width:850, height:500, title:"JSON for Demo Story"}).dialog("open");**  
        *var obj=document.createElement('textarea');  
        obj.setAttribute("style","padding-left:100");  
        obj.value=jsonList;  
        document.body.appendChild(obj);*   
        storyLst = jsonList;  
        });  
    } …
Run Code Online (Sandbox Code Playgroud)

jquery dialog

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

calendar ×1

dialog ×1

java ×1

javascript ×1

jquery ×1

timezone ×1