HTML
<!-- HTML中的注释 -->
<!DOCTYPE html> <!-- HTML的版本号 无版本代表HTML5 -->
<html> <!-- HTML最外层的标签 -->
<head> <!-- HTML头标签 里面包括大部分页面配置信息和标题 -->
<meta charset="UTF-8"><!-- 页面的字符类型 -->
<title>我的第一个html</title><!--页面的标题 -->
</head>
<body><!-- HTML的身体标签 里面放了HTML中的实际内容 -->
<!--
在HTML中 主要有两种标签
单标签:字符集设置标签<meta charset="UTF-8" />
双标签:根标签<html></html>
头标签<head></head>
标题标签<title></title>
常用单标签:
换行标签:<br />
分割线<hr />
一个英文空格
 一个中文空格
常用的双标签;
段落标签:<p></p> 换行且有段落间距
块标签:<div></div> 换行且无段落间距
标记标签:<span></span>自身不含有特性 不换行也没有段落间距
-->
<!--
超链接标签 a标签
href属性:跳转到指定页面
页面中存在路径关系:
1、绝对路径:以http://开始的路径 绝对路径 域名
服务器路径
相对路径
base路径
target属性:选择在当前页面显示新内容_self
选择在新页面显示新内容_blank
2、图片标签
img标签 src属性 添加图片路径
alt属性 当图片找不到时显示的内容
width属性 设置图片的宽度高度,不允许加px
<h3>前端的组成部分</h3>
<ul>
<!-- ol li
有序列表 -->
<li>css</li>
<li>javaScript</li>
<li>jquery</li>
</ul>
路径标签********重点
<tr>
<td>学号</td>
<td>姓名</td>
<td>班级</td>
<td>课程</td>
<td>分数</td>
</tr>
<tr>
<th width="100">学号</th>
<th width="100">姓名</th>
<th width="100">班级</th>
<th width="100">课程</th>
<th width="100">分数</th>
</tr>
</table>
<iframe src="http://www.baidu.com" width="100%" height="600" ></iframe>
<!-- form 标签 大部分标签需要name属性
action:连接java的入口
method:表单提交的方式 get post
input 标签:输入标签
type:
text 文本行标签
password 密码
radio 单选框
checkbox 多选框
button 按钮
submit 保存按钮
reset 重置按钮
select 标签:下拉框
option 选项
textarea 文本编辑器
-->
<form action="#" method="get">
用户名:<input type="text" /><br />
密&emsp码:<input type="password" /><br />
确认密码:<input type="password" /><br />
选择性别:男<input type="radio" name="gender"/>女<input type="radio" name="gender"/>
选择兴趣:java<input type="checkbox" name="hobby" />
前端<input type="checkbox" name="hobby" />
数据库<input type="checkbox" name="hobby" />
Linux<input type="checkbox" name="hobby" />
选择国家:<select>
<option>中国</option>
<option>日本</option>
<option>韩国</option>
</select>
个人说明:<texttarea></texttarea><br />
<input type="button" value="点击按钮" /> <input type="submit" value="提交"/> <input type="reset" value="重置" />
</form>
<form action="http://www.baidu.com/s" method="get">
<input type="hidden" name="enc" value="utf-8" /><实际工作中会频繁使用隐藏域 避免用户看见一些信息>
<input type="text" name="wd" id="" value="" />
<input type="submit" value="百度一下,谁知道呢" />
</form>
<form action="#" method="get">
<table>
<tr>
<td>用户名</td>
<td><input type="text" name="" id="" value="" /></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="" id="" value="" /></td>
</tr>
<tr>
<td>确认密码</td>
<td><input type="password" name="" id="" value="" /></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="eamil" name="" id="" value="" /></td>
</tr>
<tr>
<td>性别:</td>
<td>男<input type="radio" name="gender" id="" value="" />女<input type="radio" name="gender" id="" value="" /></td>
</tr>
<tr>
<td>爱好:</td>
<td>
唱<input type="checkbox" name="hobby" />
跳<input type="checkbox" name="hobby" />
rap<input type="checkbox" name="hobby" />
打篮球<input type="checkbox" name="hobby" />
</td>
</tr>
<tr>
<td>民族:</td>
<td><select name="">
<option value="">汉</option>
<option value="">苗</option>
<option value="">藏</option>
</select>
</td>
</tr>
<tr>
<td valign="top">个人说明:</td>
<td>
<textarea></textarea>
</td>
</tr>
<tr>
<td><input type="reset" name="" id="" value="重置" /></td>
<td><input type="submit" value="注册" /></td>
</tr>
</table>
</form>
</body>
</html>
CSS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>
<!--
CSS 的固定写法
属性名1:属性值1;
...
匹配所有标签 可进行样式修改
-->
</title>
<style type="text/css">
div{
border:dashed 1px;
width:400px;
height:300px;
color:blue;
background-color:green;
}
div{
border:dotted 1px;
margin-bottom:5px;
}
p{
border:dashed 1px;
}
d1{
color:red;
}
.c1{
color:green;
}
</style>
<!-- 外部导入CSS -->
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div style="border: solid 1px; width:400px; height:300px; background-color:yellow; ">
我的div
</div>
<div id="d1">
第一个div
</div>
<div>
第二个div
</div>
<div>
<p class="c1">
我是P段落
</p>
</div>
</body>
</html>
javaScript
<!DOCTYPE html>
<html>
<head>
<!-- 也可以外部引入js 如果一个script标签引入其他的js文件 name该标签中不可以编写js代码-->
<script src="" type="text/javaScript">
alert
</script>
<!-- 最简单的js版本的hello world! 需要编写script标签 -->
<script type="text/javascript">
alert("Hello World!");
</script>
<script type="text/javascript">
var i=1;
var j=1.1;
var c='s';
var str="abc";
alert(str);
var b=true;
var ary=[1,2,3,4,5];
var obj=new Object();
var stu={
id:1001,
name:"ddh",
age:21,
toString:function(){
return this.id + " "+ this.name+" "+ this.age;
}
};
alert(stu);
alert(i++);
+ - */ %
= += -= *= /= %=
> < >= <= != ==
var i=1;
var j="1";
var b=true;
alert(i==j);
alert(j==b);
alert(b==i);
alert(0==false)
var u;
alert(u);
var str="abc";
alert(str+NaN);
alert(1+null);
alert("abc"+null);
alert(typeof(1));
alert(typeof(NaN));
alert(typeof('a'));
alert(typeof([1,2,3,4,5]));
var obj=new Object();
alert(typeof(obj));
alert(typeof(undefined));
alert(typeof(null));
var ary=[3,1,2,5,4];
alert(typeof(ary) + ":" + ary);
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < array.length-i-1; j++) {
if (ary[i]>ary[j+1]) {
var temp=ary[j];
ary[j]=ary[j+1];
ary[j+1]=temp;
}
}
}
alert(ary);
ary[10]=10;
function test(){
alert("这是一个js中的函数");
}
test();
alert(typeof(test));
function add(x,y){
return x+y;
}
alert(add(5,10));
var test=function(){
alert("这是一个test函数");
}
test();
var obj=new Object();
obj.id=1001;
obj.name="lisi";
obj.age=18;
alert(obj.id + " " + obj.name + " " + obj.age);
obj.test=function(){
alert("这是obj对象中的test函数");
}
obj.toString=function(){
return this.id + " "+this.name+" "+this.age;
}
obj.test();
!!!js中的json对象 非常重要 (实质Map集合 key-value)
var jsonObject={
"id" : 1001,
"name" : "azrail",
"age" : 18
"toString" : function(){
return this.id+ " "+this.name + " "+this.age;
},
"subObj" : {
"id" : 1010,
"name" : "subObj",
}
};
alert(jsonObject.subObj.id+ " "+ jsonObject.subObj.name);
function testClick(){
alert("这是一个鼠标点击事件");
}
function checkUserName(){
var username=document.getElementById("username");
if(username.value! = null || username.value!= ""){
var span=document.getElementById("usernameSpan");
span.innerHTML="用户名不能为空!";
}else{
span.innerHTML=" ";
}
}
</script>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="button" name="" id="" value="这是一个按钮" onclick="testClick()" /><br />
<h1>用户注册</h1>
用户名:<input type="text" name="" id="" value="" /><br />
密 码: <input type="password" name=" " id="" value="" />
</body>
</html>