【题目要求】
实现简单的整数加法
【知识点】
A.标签
1.<style></style>
用法:必需的 type 属性规定样式表的 MIME 类型。
type 属性指示 <style> 与 </style> 标签之间的内容。里面的内容指:想要使用的属性,比如:更改标签的字体显示的颜色,长宽高等
值 "text/css" 指示内容是标准的 CSS。
<!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=utf-8" />
<title>style标签学习</title>
<style type="text/css">
h1 {color:red;}
p {color:blue;}
</style>
</head>
<body>
<h1>这是一个标题</h1><!--h1和p1都是可以直接输出一段,但是两者输出字号不同 -->
<p>这是一个段落</p>
</body>
</html>
2.<blockquote></blockquote>
用法:长引用块,不会顶格边框,有间距
<!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=utf-8" />
<title>bolckquote标签的使用</title>
</head>
<body>
<blockquote>
<p>这是一个长引用块,这是一个长引用块!</p>
</blockquote>
</body>
</html>
3.<form></form>、<input />、
表单属性:
<from 表单的属性有:
取值:text/plain–以纯文本的形式传送,application/x-www-from-urlencoded–默认的编码方式,multipart/form-data –MIME编码,上传文件的表单必须选择他;就是form里设置enctype=”multipart/form-data”,这样才能在提交表单时,将文件以二进制流的形式传输到服务器;
name="表单名称" ,非必须但是为避免混乱,不同表单尽量用不同的名字,且应该与表单的功能相符;
action="表单提交地址",真正处理表单的数据脚本和程序,可以是*.php\*.html\*.asp\mailto:等等;
method="数据提交方式",get\post,两者区别还不知道就该自己认认真真去查了;
enctype="表单信息提交的编码方式",
target="目标窗口打开方式",_blank 、_parent、_self、 _top;>
输入流属性:
<input ,输入类的控件
type=”控件类型” ://text文本输入框 | password密码输入框,(文本类参数有:name,size,maxlength,value);//button按钮(name,value , onclick) | submit提交按钮(name , value) | reset重置按钮(name , value) | radio单选按钮(name必须设置相同 , value,checked只能有一项被设置,设置多个时,选中的为最后一个) | checkbox复选按钮(name设置相同 , value ,checked可以设置多个,都为选中状态) | image图像按钮(src ,name) | hidden 隐藏域,主要用来传递一些数据,不会显示在页面中(name, value)>
【代码】
<!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=utf-8" />
<title>加法计数器</title>
<style type="text/css">
<!--
.STYLE1{
front-size:100px;
front-weight:bold;
}
-->
</style>
</head>
<body>
<blockquote>
<!-- 之间的所有文本都会从常规文本章分离出来,便于使用自定义-->
<blockquote>
<blockquote>
<p class="STYLE1">加法计数器</p>
</blockquote>
</blockquote>
</blockquote>
<form id="form1" name="form1" method="post" action="">
<label>
<input name="number1" type="text" id="number1" size="10" />
<!-- 输入流input -->
</label>
+
<label>
<input name="number2" type="text" id="number2" size="10" />
</label>
<label>
<input type="submit" name="Submit" value="等于" />
</label>
<?php
if(isset($_POST['Submit']) and $_POST['number1']!=null and $_POST['number2']!=null and $_POST['Submit']=="等于"){
$number3=$_POST['number1']+$_POST['number2'];
}
else{
$number3=null;
}
?>
<label>
<input name="number3" type="text" id="number3" size="10" value="<?php echo $number3;?>"/>
<!--输出变量值-->
</label>
</form>
</body>
</html>