您的位置:首页 > 编程语言 > Java开发

天生丽质小仙女java实训笔记基础00

2017-06-27 21:08 465 查看
      IDE:(Integrated Development
Environment)集成开发环境





一、标识符的命名规则:

   1.Java标识符由数字,字母和下划线(_),美元符号($)或人民币符号(¥)组成



   2.Java中是区分大小写的,而且还要求首位不能是数字。最重要的是,Java关键字不能当作Java标识符

二、服务器:







     1、硬件服务器:电脑一样的东西, 它负责存储,运算,处理数据等,他有CPU,硬盘,内存,显卡,主板!

     2、软件服务器:例如tomcat 是软件服务器,可以运行一些软件在服务器上。

三、Get和Post的区别:

         1、Get是用来从服务器上获得数据,而Post是用来向服务器上传递数据。

        2、Get提交会把表单填写的内容在地址栏URL中显示 相对来说是不安全的。

        3、Get传输的数据量小,这主要是因为受URL长度限制;而Post可以传输大量的数据,所以在上传文件只能使用Post。

四、div和span:



1、span是行级标签,span是块级标签

2、div和span不会对元素内里面的内容产生影响,可以通过css来给里面的内容设置样式。

3、可以通过display属性来相互转换


默认端口号:

1、Tomcat   默认端口号8080
2、MySQL   默认端口号3306
3、SqlServer  默认端口号 1433
4、Http    默认端口号 80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<title>用户注册</title>
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<style type="text/css">
input{
height: 25px;
width: 170px;
}
</style>

<!-- 导入工具js文件 -->
<script type="text/javascript" src="js/tool.js"></script>

<!-- 单个验证 -->
<script type="text/javascript">
function writeEach(id){
var message = "";

if(id == "email"){
message = "<b style='color:green'>请填写你的常用邮箱</b>";
}
if(id == "nickname"){
message = "<b style='color:green'>最多26个字符,一个汉字占两个字符</b>";
}
if(id == "pwd"){
message = "<b style='color:green'>以字母开头,6~16个字符</b>";
}
if(id == "confirm"){
message = "<b style='color:green'>请再填写一次密码";
}
var spanId = id + "Error";
document.getElementById(spanId).innerHTML = message;
}
function checkEach(id,value){
value = trim(value);
var message = "<img src='image/right.jpg'/>";

if(id == "email" && value == ""){
message = "<img src='image/wrong.jpg'/><b style='color:red'>邮箱是必填的</b>";
}else if(id == "email" && !checkEmailFormat(value)){
message = "<img src='image/wrong.jpg'/><b style='color:red'>邮箱格式不正确</b>";
}
if(id == "nickname" && value == ""){
message = "<img src='image/wrong.jpg'/><b style='color:red'>昵称是必填的</b>";
}
if(id == "pwd" && value == ""){
message = "<img src='image/wrong.jpg'/><b style='color:red'>密码是必填的</b>";
}else if(id == "pwd" && value.length > 16){
message = "<img src='image/wrong.jpg'/><b style='color:red'>太长了,最多16个字符</b>";
}else if(id == "pwd" && value.length <6){
message = "<img src='image/wrong.jpg'/><b style='color:red'>太短了,最少6个字符</b>";
}
if(id == "confirm" && value == ""){
message = "<img src='image/wrong.jpg'/><b style='color:red'>请输入确认密码</b>";
}else if(id == "confirm" && value != document.getElementById("pwd").value){
message = "<img src='image/wrong.jpg'/><b style='color:red'>两次密码不一致</b>";
}

var spanId = id + "Error";
document.getElementById(spanId).innerHTML = message;
}
</script>

<!-- 整体验证 -->
<script type="text/javascript">
function checkAll(){
var flag = true;

var email = document.getElementById("email").value;
alert(email);
email = trim(email);
if(email == ""){
document.getElementById("emailError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>邮箱是必填的</b>";
flag = false;
}else if(!checkEmailFormat(email)){
document.getElementById("emailError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>邮箱格式不正确</b>";
flag = false;
}
var nickname = document.getElementById("nickname").value;
nickname = trim(nickname);
if(nickname == ""){
document.getElementById("nicknameError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>昵称是必填的</b>";
flag = false;
}
var pwd = document.getElementById("pwd").value;
pwd = trim(pwd);
if(pwd == ""){
document.getElementById("pwdError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>密码是必填的</b>";
flag = false;
}else if(pwd.length > 16){
document.getElementById("pwdError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>太长了,最多16个字符</b>";
flag = false;
}else if(pwd.length < 6){
document.getElementById("pwdError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>太短了,最少6个字符</b>";
flag = false;
}
var confirm = document.getElementById("confirm").value;
confirm = trim(confirm);
if(confirm == ""){
document.getElementById("confirmError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>请输入确认密码</b>";
flag = false;
}else if(confirm != document.getElementById("pwd").value){
document.getElementById("confirmError").innerHTML =
"<img src='image/wrong.jpg'/><b style='color:red'>两次密码不一致</b>";
flag = false;
}

return flag;
}
</script>
</head>

<body>
<h1 style="color: red;font-size: 100px;" align="center">用户注册</h1>
<hr>
<form id="regForm" name="regForm"
method="get" action="http://www.baidu.com" onsubmit="return checkAll()">
<table>
<tr>
<td>邮箱:</td>
<td><input type="text" id="email" name="email" onfocus="writeEach(this.id)" onblur="checkEach(this.id,this.value)"/>
<span id="emailError"></span></td>
</tr>
<tr>
<td>昵称:</td>
<td><input type="text" id="nickname" name="nickname" onfocus="writeEach(this.id)" onblur="checkEach(this.id,this.value)"/>
<span id="nicknameError"></span></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" id="pwd" name="pwd" onfocus="writeEach(this.id)" onblur="checkEach(this.id,this.value)"/>
<span id="pwdError"></span></td>
</tr>
<tr>
<td>确认密码:</td>
<td><input type="password" id="confirm" name="confirm" onfocus="writeEach(this.id)" onblur="checkEach(this.id,this.value)"/>
<span id="confirmError"></span></td>
</tr>
</table>
<input type="submit" style="height: 30px;width: 80px;" value="注册新用户"/>
</form>
<hr>
</body>
</html>



今天好开心 学到了好多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息