天生麗質小仙女java實訓筆記基礎00

      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" οnsubmit="return checkAll()">
    	<table>
    		<tr>
    			<td>郵箱:</td>
    			<td><input type="text" id="email" name="email" οnfοcus="writeEach(this.id)" οnblur="checkEach(this.id,this.value)"/>
    				<span id="emailError"></span></td>
    		</tr>
    		<tr>
    			<td>暱稱:</td>
    			<td><input type="text" id="nickname" name="nickname" οnfοcus="writeEach(this.id)" οnblur="checkEach(this.id,this.value)"/>
    				<span id="nicknameError"></span></td>
    		</tr>
    		<tr>
    			<td>密碼:</td>
    			<td><input type="password" id="pwd" name="pwd" οnfοcus="writeEach(this.id)" οnblur="checkEach(this.id,this.value)"/>
    				<span id="pwdError"></span></td>
    		</tr>
    		<tr>
    			<td>確認密碼:</td>
    			<td><input type="password" id="confirm" name="confirm" οnfοcus="writeEach(this.id)" οnblur="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>


微笑今天好開心 學到了好多


發佈了21 篇原創文章 · 獲贊 6 · 訪問量 5185
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章