零基础学习HTML(17)——input标签(一)


注:学习笔记基于小甲鱼学习视频,官方论坛: https://fishc.com.cn/forum.php

官方资料

鱼C课程案例库:https://ilovefishc.com/html5/
html5速查手册:https://man.ilovefishc.com/html5/
css速查手册:https://man.ilovefishc.com/css3/

学习正文

  • input 标签可以向 button 一样成为提交按钮,往往通过一些全局事件onclick()来绑定JS
<!DOCTYPE html>
<html>
<head>
    <title>第十七节课</title>
    <meta charset="utf-8">
	<title>input</title>
</head>
<body>
	<p>小甲鱼的课程</p>
	<input type="button" value="按钮">
    <button type="button">按钮</button>
    <input type="button" value="按钮" onclick="fishc()">
    <script>
        function fishc() {
            alert("我爱鱼C");
        }
    </script>
</body>
</html>

在这里插入图片描述
当把type值设置为 radio,便可以实现单选框(单选需要相同的 name):

<!DOCTYPE html>
<html>
<head>
    <title>第十七节课</title>
    <meta charset="utf-8">
	<title>input</title>
</head>
<body>
    <input type="radio" name="myredio"><input type="radio" name="myredio"><input type="radio" name="myredio">非男非女
</body>
</html>

在这里插入图片描述
将 type 设置为 checkbox 可以实现多选:

<!DOCTYPE html>
<html>
<head>
    <title>第十七节课</title>
    <meta charset="utf-8">
	<title>input</title>
</head>
<body>
    <input type="checkbox" name="fruit">西瓜
    <input type="checkbox" name="fruit">香蕉
    <input type="checkbox" name="fruit">草莓
</body>
</html>

在这里插入图片描述
input 还可以显示时间格式:

<!DOCTYPE html>
<html>
<head>
    <title>第十七节课</title>
    <meta charset="utf-8">
	<title>input</title>
</head>
<body>
    时间:<input type="time" name="time">
    <br><br>
    日期:<input type="date" name="date">
    <br><br>
    年月:<input type="month" name="month">
    <br><br>
    星期:<input type="week" name="week">
    <br><br>
    本地日期和时间:<input type="datetime-local" name="datetime-local">
</body>
</html>

在这里插入图片描述

html 中的保留字符:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值