JavaScript 基础,登录验证

Posted 袁华生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 基础,登录验证相关的知识,希望对你有一定的参考价值。

1.

(1)<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jsDemo</title>
</head>
<body>
<p id="demo">ppp</p>
<script>
//document.write(Date())
document.getElementById("demo").innerHTML=Date();
</script>
<button type="button" onclick=window.alert("number")>input</button>
</body>
</html> 

(2)<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<title>jsDemo</title>
<script>
function displayDate(){
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
<p id="demo">ppp</p>
<button type="button" onclick=window.alert("number")>input</button>
</body>
</html>

(3)mySript.js文件:

function myFunction(){

document.getElementByld("demo").innerHTML="我的javascript函数";
}

2.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jsDemo</title>
</head>
<body>
<p id="demo">ppp</p>
<script>
//document.write(Date())
document.getElementById("demo").innerHTML=Date();
</script>
<button type="button" onclick=window.alert("number")>input</button>
</body>
</html>

3.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登陆</title>
<link href="../static/css/denglu.css" rel="stylesheet" type="text/css">
<script>
function fnLogin() {
var oUname=document.getElementById("uname")
var oUpass=document.getElementById("upass")
var oError=document.getElementById("error_box")
if(6<oUname.value.length<20){
oError.innerHTML="用户名6-20位"
}
}
</script>

</head>
<body>
<div class="box">
<h2>登陆</h2>

<div class="input_box">
<input id="uname" type="text" placeholder="请输入用户名">
</div>
<div class="input_box">
<input id="upass" type="password" placeholder="请输入密码">
</div>
<div id="error_box"><br></div>
<div class="input_box">
<button onclick="fnLogin()">登陆</button>
</div>
</div>
</body>
</html>

 











































































以上是关于JavaScript 基础,登录验证的主要内容,如果未能解决你的问题,请参考以下文章

JavaScript 基础,登录验证

JavaScript 基础,登录验证

JavaScript 基础,登录验证

JavaScript 基础,登录验证

JavaScript 基础,登录前端验证

JavaScript 基础,登录前端验证