html 标签学习

form 属性

 

定义和用法

 

enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码。

默认地,表单数据会编码为 "application/x-www-form-urlencoded"。就是说,在发送到服务器之前,所有字符都会进行编码(空格转换为 "+" 加号,特殊符号转换为 ASCII HEX 值)。

语法

<form enctype="value">

属性值

描述
application/x-www-form-urlencoded 在发送前编码所有字符(默认)
multipart/form-data

不对字符编码。

在使用包含文件上传控件的表单时,必须使用该值。

text/plain 空格转换为 "+" 加号,但不对特殊字符编码。
上传文件
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="doAction.php " method="post" enctype="multipart/form-data">
  请选择上传文件:<input type="file" name="myFile"/><br/>
          <input type="submit" value="上传"/>
</form>
</body>
</html>



选择上传文件

上传到doAction.php

$_FILES中保存上传文件的信息

HTML 表单和输入

复选框 Checkbox的学习,利用checkbox删除多个

选中多个进行删除
<!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" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>    </title>
</head>
<body>
    <form action="test.php" method="GET">

        <table width="100%" cellspacing="1" cellpadding="2" id="list-table">

            <tr align="center">
                <td align="left">
                    <input type="checkbox" class="check" name="id[]" value="1"> 
                    <a href="###" id="name">Name </a>
                </td> 
            </tr> 
            <tr align="center">
                <td align="left">
                    <input type="checkbox" class="check" name="id[]" value="1"> 
                    <a href="###" id="name">Name </a>
                </td> 
            </tr>
            <tr align="center">
                <td align="left">
                    <input type="checkbox" class="check" name="id[]" value="1"> 
                    <a href="###" id="name">Name </a>
                </td> 
            </tr> 
            <tr align="center">
                <td align="left">
                    <input type="checkbox" class="check" name="id[]" value="1"> 
                    <a href="###" id="name">Name </a>
                </td> 
            </tr>
            <tr align="center">
                <td align="left">
                    <input type="checkbox" class="check" name="id[]" value="1"> 
                    <a href="###" id="name">Name </a>
                </td> 
            </tr> 
            <tr><input type="submit" value="删除全部"></tr>
        </table>
    </form>   
</body>
</html>

 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
^_^o~ 努力!不断学习中~
posted @ 2015-01-25 11:02  sunniejs  阅读(201)  评论(0编辑  收藏  举报