这里是我的代码
包括数据转发器的文件:
<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="css/jsDatePick_ltr.min.css"/>
<script type="text/javascript" src="js/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
new JsDatePick({
useMode:2,
target:"date",
dateFormat:"%d-%m-%Y"
});
};
</script>
</head>这里,我想在两个字段中显示date和date1,但是它不是在一个字段中显示的:
<body>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25"> </td>
<td width="45" class="form_txt">Date : </td>
<td width="105"><input name="date" style="color:black;background:white" type="text" id="date" style="" /></td>
<td width="87"><img src="../images/cal.jpg" width="36" height="18" /></td>
<td width="45" class="form_txt">Date1 : </td>
<td width="105"><input name="date" style="color:black;background:white" type="text" id="date1" style="" /></td>
<td width="87"><img src="../images/cal.jpg" width="36" height="18" /></td>
</tr>
</table>
</body>
</html>发布于 2013-06-11 11:41:32
不能在页面上多次使用相同的id属性值.您需要创建两个jsDatePick..。就像这样:
window.onload = function(){
new JsDatePick({
useMode:2,
target:"date",
dateFormat:"%d-%m-%Y"
});
new JsDatePick({
useMode:2,
target:"date2",
dateFormat:"%d-%m-%Y"
});
};然后你的HTML应该是
<td width="105"><input name="date" style="color:black;background:white" type="text" id="date" style="" /></td>
<td width="105"><input name="date2" style="color:black;background:white" type="text" id="date2" style="" /></td>注意第二个input上的更改,现在将date2用于id和name
https://stackoverflow.com/questions/17043150
复制相似问题