<input type="text" readonly name"name" id="id">用户点击此文本框时,弹出日历控件,选择日期后设置文本框的值。
要根据这个文本框的值,设置其他域的值,应该触发什么事件?我试了blur不行,change也不行。改怎么办?
要根据这个文本框的值,设置其他域的值,应该触发什么事件?我试了blur不行,change也不行。改怎么办?
调试欢乐多
ff下 用oninput
// 设置值},10);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<input type="text" readonly name="name" id="calendarTxt"><input type="button" value="Change Date and Show" onclick="ChangeDatetime('calendarTxt');DoSomethingByInputDatetime('calendarTxt')" />
<script type="text/javascript">
<!--
function ChangeDatetime(targetId) {
var input = document.getElementById(targetId);
if (input)
{
input.value = (new Date()).toLocaleDateString();
}
}
function DoSomethingByInputDatetime(targetId) {
var input = document.getElementById(targetId);
if (input)
{
alert("输入的日期为:" + input.value);
}
}
//-->
</script>
</body>
</html>