iframe/a/form/table/input/button/submit

a标签的targe
<!--a标签的target可以指向iframe的name属性-->
<iframe name="xxx" src="" frameborder="0"></iframe>
<a target="xxx" href="http://baidu.com" >baidu</a>
<a target="xxx" href="http://qq.com" >qq</a>
<!--a标签的targe属性-->
<a target="_blank" href="http://baidu.com" >baidu</a><!--在空页面打开-->
<a target="_self" href="http://baidu.com" >baidu</a><!--在当前页面打开-->
<a target="_parent" href="http://baidu.com" >baidu</a><!--在父级页面打开-->
<a target="_top" href="http://baidu.com" >baidu</a><!--在顶层页面打开-->
a标签的download
<!--a标签的download:有两种响应决定。-->
<!--1. download-->
<a target="_blank" href="http://baidu.com"  download>baidu</a><!--在空页面打开-->
<!--2. 由HTTP响应决定 -->
Content-type: application/octet-stream
<!--如果-->
Content-type: text/html
<!--则需要在a标签中加入download强制下载,如1 -->
a标签的href
<!--不会打开www.baidu.com,打开的是baidu.com文件,并非域名,如果想要访问baidu.com请写全域名http://baidu.com-->
<a href="baidu.com" >baidu</a>
<a href="./baidu.com" >baidu</a>

<!--如果没有http:或者https:,也就是说以//开始的协议(也叫做a标签的无协议地址),那么代表当前文件是什么协议就用什么协议,但一般都要指定协议,coding时不要用file协议-->
<a href="//baidu.com" >baidu</a>

<!--如果href是个锚点,则会跟在连接后,进行当前页面跳转,也就是无get请求-->
<a href="#dfdfd" >baidu</a>

<!--自动将?name=haha加到a.html后(http://127.0.0.1:8080/a.html?name=haha)并发起一个get请求-->
<a href="?name=haha" >baidu</a>

<!--JavaScript伪协议-->
<a href="javascript:;" >baidu</a>
form

form主要是用来发起post请求的,file协议不支持post。

------ get ------

get默认会把参数放到查询参数中,但是不会出现第四部分Form Datta,如图image1.png:


8440513-aa084fba4e94c910.png
image1.png
------ post ------

post 1. 默认会把参数放到第四部分Form Datta,如图image2.png


8440513-4685b6a526667cad.png
image2.png
  1. 想要post支持查询参数,可以这样写
<form action="users?username=haha" method="post">
...
</form>

结果如图image3.png:


8440513-b3bc1659f28b6866.png
image3.png

form表单提交后,post的请求类型Content-Type: application/x-www-form-urlencodedutf-8编码,对应的编码解析可以在浏览器中的view source中查看到,每一个字节对应一个百分号,三个字节对应一个汉字。如图:

8440513-66475af45998d41a.png
image.png

8440513-53dc130430d6e57c.png
image.png

8440513-57d847d1d0e75210.png
image.png

input botton

type都设置为button时,不能提交。
type都设置为submit时,能提交。
botton如果什么都不设置,则自带submit功能,能提交。

    <form action="666">
        <input type="button" value="提交">不能提交
        <button type="button">提交</button>不能提交
        <input type="submit" value="提交">能提交
        <button type="submit">提交</button>能提交
        <button>提交</button>能提交
    </form>

label的for与input的id是一对。如果不想设置for与id,则用label包含input即可。

    <form action="">
        <label for="ss">姓名</label><input type="text" id="ss">
        <label>姓名<input type="text"></label>
    </form>
PS:
  1. 写全域名
  2. a标签都是get请求
  3. 如果form表单没有提交按钮则无法提交form ,除非用js
  4. <a>、<from> 都有target标签
  5. https://github.com/wnkl/test/blob/master/form:iframe:input:button:table.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值