JavaScript代码(1)
//后台CS调用前台JS方法
ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script>CheckInput()</script>");
//校验输入框是否为空,校验是否是数字
<script type="text/javascript" language="javascript">
function CheckInput() {
if (document.form1.txt_ReceiptID.value == "") {
alert('报销单号不能为空!');
document.form1.txt_ReceiptID.focus();
return false;
}
else {
if(checknumber(document.form1.txt_ReceiptID.value)
{
alert("报销单号为数字!");
document.form1.txt_ReceiptID.focus();
return false;
&nbs
相关文档:
① JavaScript添加位置,添加位置错误,会引起JavaScript代码无法执行的问题。
<head runat="server">
<script type='text/javascript' language="javascript">
<!—
//“添加内容”
//-->
</script>
</head>
② 引用他处的脚本 ......
<table>
<tr>
<td style="width: 201px; height: 22px;" valign="middle" align="right">
&n ......
对于JavaScript的 Stack overflow at line 错误总结
该错误只在IE中出现,出现该提示的原因主要有两种:
1. 重定义了系统的触发事件名称作为自定义函数名如: onclick / onsubmit ... 都是系统保留的事件名称,不允许作为重定义函数名称。
2. ......
创建一个日期对象:
var objDate=new Date([arguments list]);
参数形式有以下5种:
new Date("month dd,yyyy hh:mm:ss");
new Date("month dd,yyyy");
new Date(yyyy,mth,dd,hh,mm,ss);
new Date(yyyy,mth,dd);
new Date(ms); ......
var myDate = new Date();
myDate.getYear(); //获取当前年份(2位)
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1月)
myDate.getDate();   ......