javascript简单验证
<html>
<head>
<base href="<%=basePath%>">
<script type="text/javascript">
function check(){
var name1 = document.form1.name1.value;
var password1 = document.form1.password1.value;
var email = document.form1.email.value;
if(name1 == ""){
alert("用户名不能为空!");
return false;
}
else if(password1.length<4 || password1==""){
alert("密码不能少于4位");
return false;
}else {
var idxEmail = email.indexOf('@');
if(idxEmail <=0 || idxEmail == email.length - 1){
alert("Email地址格式不合法");
return false;
}
}
}
</script>
</head>
<body>
<form action="registerOK.jsp" method="post" name="form1" onsubmit="return check()">
<input type="text" name="name1"/>
<input type="password" name="password1"/>
<input type="text" name="email" />
<input type="submit" value="提交">
</form>
</body>
</html>
相关文档:
// 下面代码块实现了string.parseJSON方法
(function(s){
// This prototype has been released into the Public Domain, 2007-03-20
// Original Authorship: Douglas Crockford
// Originating Website: http://www.JSON.org
// Originating URL : http://www.JSON.o ......
1. document.write( " "); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document- >html- >(head,body)
4.一个浏览器窗口中的DOM顺序是:window- >(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementB ......
<!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> JavaScript: xm ......
Siebel支持在浏览器的地址栏使用javascript
例如
javascript:alert(theApplication().GetProfielAttr("Employee Flag");
javascript:var sBo = theApplication().ActiveBusObject();sBc = sBo.GetBusComp("Contact");alert(sBc.GetFieldValue("Last Name")); ......
javascript, webservice, 天气预报
运行演示,请点击这里:>>天气预报 WebService JavaScript Web页面调用代码,转载及使用该代码,请保留作者信息,其它部分您可任意修改。
源代碼:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCT ......