日期选择器返回的日期为一天.这是我的代码中的问题还是一个错误?
发送到date_picker的日期是2012-03-21.datepicker返回的日期是2012年3月20日星期二.
    var end_date = end_calendar.getFormatedDate("%Y-%m-%d");
    end_date = $.datepicker.formatDate('D M dd yy', new Date(end_date));
使用这些css样式,我会阻止页面上突出显示的文本选择.但这会导致输入字段在Safari上被用户输入锁定.
* {
-webkit-touch-callout: none;
-webkit-user-select: none; // locks fields on Safari
-khtml-user-select: none; // locks fields on Safari
-moz-user-select: none;
-ms-user-select: none;
user-select: none;      
}
在Safari上是否有办法防止用户选择而不干扰输入字段?
我有一个对象数组,如下所示:
event_id=[{"0":"e1"},{"0","e2"},{"0","e4"}];
如何向该数组添加元素?
我想到了
event_id.splice(1,0,{"0":"e5"});
谢谢.
使用PHP指定CSV文件的行尾字符的正确方法是什么.我有这个脚本来写CSV文件.
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
include_once("phpshared.php");
function get_node_urls( $nodeid ) {
$nodes = new SimpleXMLElement('linkcards.xml', null, true);
$nodesarray = $nodes->xpath("//LINKCARD[@ID='$nodeid']");  
$linkstring = '';
$node = $nodesarray[0]; 
$i = 0;
foreach($node->LINKS->LINK as $url)
{ 
       $linkstring .= $i.','.$url['ID'].','.$url->TITLE.','.$url->URL.'\r\n';
       $i++;
}
echo $linkstring;
}
echo get_node_urls(trim($_REQUEST['nodeid']));
?>
如果我加载$linkstring,则每行末尾没有回车符.这些行应该是:
0, id1, http://link1.com 1, id2, http://link2.com
相反,它们是:
0, id1, http://link1.com\r\n1, id2, http://link2.com
CSV读取器将该行读取为:
id1 http://link1.com\r\n1
是否有不同的方式为CSV写入行尾?
如何在输入掩码中指定可选字符?
我发现这个屏蔽输入插件http://digitalbush.com/projects/masked-input-plugin/和这些掩码定义.
$.mask.definitions['g']="[ ]";
$.mask.definitions['h']="[aApP]";
$.mask.definitions['i']="[mM]";
$.mask.definitions['2']="[0-1]";
$.mask.definitions['6']="[0-5]";
new_mask = "29:69";
$("#txtTime").mask(new_mask);
这定义了12小时时间格式的输入掩码,例如11:00.我想让用户只为"小时"指定一个数字.用户应该能够键入1:00,而不必键入01:00.我怎么做?
我有一个这种结构的xml文件
<?xml version="1.0" encoding="iso-8859-1"?>
<my_events>
                        <event id="e20111129215359">
                            <title>the title</title>
                            <channel id="1">
                                <name>A name</name>
                                <onclick></onclick>
                            </channel>
                            <event_site>
                                <name/>
                                <url/>
                            </event_site>
                            <start_date>Thu Mar 08 2012</start_date>
                            <start_time>11:00 AM</start_time>
                            <end_date>null</end_date>
                            <end_time>null</end_time>
                            <notes>Notes for the event</notes>
                        </event>
 </my_events>
要删除一个事件,我有这个PHP功能.
<?php
include_once("phpshared.php");
function delete_event( $nodeid ) {
    $nodes = new SimpleXMLElement('my_events.xml', LIBXML_NOCDATA, true);
    $node = $nodes->xpath("/my_events/event[@id='$nodeid']");
    $node->parentNode->removeChild($node);
    $formatted = formatXmlString($nodes->asXML());
    $file = fopen ('my_events.xml', "w"); 
    fwrite($file, $formatted); 
    fclose ($file);  
}
echo delete_event(trim($_REQUEST['nodeid']));
?>
这不会删除节点.有没有不同的方法来做到这一点?
我从日期中减去天数的代码无法获得正确的结果.
function get_Ash_Wednesday_date (year, Easter_month, Easter_day) {
    var Easter_date = new Date();
    Easter_date.setFullYear(year, Easter_month-1, Easter_day);
    var Ash_Wednesday = new Date();
    Ash_Wednesday.setFullYear(year);
    Ash_Wednesday.setDate(Easter_date.getDate()-46);
    return Ash_Wednesday;
}
从复活节开始,我减去46天.这通常可以追溯到二月,必须考虑到闰年.计算的灰烬周三日期为一天或两天,例如2012年灰烬周三应为02/22,2013应为02/13,2014应为03/05,2015应为02/18,2016应该是02/10.这个月每次都错了,应该是2月或3月.什么可以解释返回的日子和月份的差异?
Year: 2012 Ash Wednesday month 11 Ash Wednesday day 23 Easter Month: 4 Easter Day: 8
Year: 2013 Ash Wednesday month 12 Ash Wednesday day 16 Easter Month: 3 Easter Day: 31
Year: 2014 Ash Wednesday month 12 Ash Wednesday day 5 Easter Month: 4 Easter Day: 20
Year: 2015 Ash Wednesday month 11 …如何访问子窗口中父窗口中定义的全局对象或数组.
<script>
    var events_data;
    function function_to_fill_events_data () {
      .
      .
      .
    }
</script>
<div>
    <div><iframe src="mini.php" width:100%; height: 100%;" scrolling="no"></iframe> </div>
</div>
当我在迷你文档中时,我希望能够在javascript函数中访问events_data变量.
找到这段代码来打印我修改过的 javascript 元素。尽管我添加了document.title和<title></title>标签,但在常规文本编辑器中打开的窗口显示untitled。
这通常是文本保存之前的情况。有没有办法显示标题?
    var element=document.getElementById(element_id);
    var newWin=window.open('','Print-Window','width=400,height=400,top=100,left=100');
    newWin.document.open();
    newWin.document.title = "Readings on PageLinks";
    newWin.document.write('<html><head><title>'+newWin.document.title+'</title></head><body   onload="window.print()">'+element.innerHTML+'</body></html>');
    newWin.document.close();
    setTimeout(function(){ newWin.close(); },10);
可能重复:
如何让div浮动到其容器的底部?
我有这个代码将div浮动到div的右下方.但跨度停留在左上角.
<div id="color_tile" class="select_tile" title="Choose color" style="background: grey; background-image: url(wallpaper/201_color_picker.jpg);" >    
  <span id="color_picker" style="visibility: visible; display: block; float: right; vertical-align: bottom;"></span>
</div>
是否有不同的方式来放置跨度?
javascript ×6
css ×2
html ×2
php ×2
csv ×1
date ×1
datepicker ×1
iframe ×1
input ×1
jquery ×1
mask ×1
parent-child ×1
simplexml ×1
window.open ×1
xml ×1