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
相关文档:
如果你完全不懂,那么期望1-2周看完一遍拉倒....不用看的太仔细,后面再看到不懂的时候回头去看这些东西好了。
1. 前言和准备工作
这里不会介绍什么软件的用法一类的东西。如果觉得手写代码是在装的人可以出去了,谢谢。
首先你要有台电脑。然后它应该装着windows 和 IE。下面所谈到的代码 ......
① JavaScript添加位置,添加位置错误,会引起JavaScript代码无法执行的问题。
<head runat="server">
<script type='text/javascript' language="javascript">
<!—
//“添加内容”
//-->
</script>
</head>
② 引用他处的脚本 ......
<a href="#" onclick="ChildNode(this);">aaa</a>要改为
<a href="#" onclick="ChildNode(event);">aaa</a>
无法取得this对象,要用以下方法来取得。
function ChildNode(e)
{
var evt = e ? e : (window.event ? window.event : null); //此方法为了在firefox中的兼容
var node = evt.srcEl ......
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>vForm表单验证程 ......