html基础须知

HTML,超文本标记语言

HTML 实例

<html>

<head>

            <meta charset="UTF-8"><!--HTML 文档的字符编码-->

            <title>我的标题标签</title>

            <link rel="stylesheet" type="text/css" href="css/theme.css"><!--定义该文档与链接资源间的关系-->

            <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>

            <script type="text/javascript">

                         <!--这里写JS代码,被调用时被执行-->

                          function changeImg1(obj) {
                                             obj.width=300;
                                             obj.height=300;
                                     }
                                     function changeImg2(obj) {
                                             obj.width=150;
                                             obj.height=150;
                                     }

            </script>

</head>

<body>

            <!--我的身体(内容)-->

            <img title="鼠标移动到该元素上显示的额外信息" alt="图片不能正常加载时出现" src="" width="150" height="150" onmouseover="changeImg1(this)" onmouseout="changeImg2(this)">

            <script type="text/javascript">
                                   document.write("<h3>我要上传</h3>")
                       </script><!--这里写JS代码,页面被加载时被执行-->

                       <form action="matchFUP" name="form1" method="post" enctype="multipart/form-data">
                                  <input type="hidden" name="type" value="admin">
                                  <input type="hidden" name="operation" value="上传">

                                  <input type="file" name="fileUpload">
                                  <input type="password" name="pswd">
                                  <span onclick="javascript:form1.submit();">上传</span>
                       </form>

                       <audio controls="controls" height="100" width="100">
                                   <source src="VF/music.mp3" type="audio/mpeg">
                                   <source src="VF/music.ogg" type="audio/ogg">
                                   <embed height="50" width="100" src="VF/music.mp3">
                       </audio><!--HTML5 <audio> 元素尝试以 mp3 或 ogg 播放音频。如失败,代码回退尝试 <embed> 元素,最好的 HTML 解决方法-->
                       <iframe height='400' width='480' src='http://player.youku.com/embed/XNDA0NzM1NTI1Ng==' frameborder='0' allowFullScreen='true'></iframe><!--视频播放通用代码,把视频上传到优酷等网站,在您网页中插入 HTML 代码,获取分享的URL替换src中的值就行-->

</body>

</html>

HTML常用事件

onclick当单击鼠标时执行脚本;

onkeydown当按下按键时执行脚本;

onkeyup当松开按键时执行脚本;

onchange当元素被改变时执行脚本;

onfocus当元素获得焦点时执行脚本;

onmouseover当鼠标指针移到元素上时执行脚本;

onmouseout当鼠标指针移出元素时执行脚本;

onblur当窗口失去焦点时执行脚本;

onselect当选取元素时执行脚本;

 

猜你喜欢

转载自blog.csdn.net/CJ_L1995/article/details/87637677