首页 > 其他分享 >一些常用的HTML标签

一些常用的HTML标签

时间:2023-03-25 21:13:08浏览次数:38  
标签:常用 标签 image tr HTML file var imagePreview preview

空格

nbsp;

长传图片在上面实时显示

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片预览示例</title>
    <style>
        .image-preview {
            max-width: 100%;
            max-height: 300px;
        }
    </style>
</head>
<body>
<input type="file" id="input-image" accept="image/*">
<img id="image-preview" class="image-preview" src="#" alt="预览图片" style="display:none;">

<script>
    document.getElementById('input-image').addEventListener('change', function (event) {
        var file = event.target.files[0];
        var reader = new FileReader();

        reader.onload = function (e) {
            var imagePreview = document.getElementById('image-preview');
            imagePreview.src = e.target.result;
            imagePreview.style.display = 'block';
        };

        if (file) {
            reader.readAsDataURL(file);
        } else {
            document.getElementById('image-preview').style.display = 'none';
        }
    });
</script>
</body>
</html>

表格序号自增

//tr开始主动加一
$(function(){
        //$('table tr:not(:first)').remove();
        var len = $('table tr').length;
        for(var i = 1;i<len;i++){
            $('table tr:eq('+i+') td:first').text(i);
        }
 
});

标签:常用,标签,image,tr,HTML,file,var,imagePreview,preview
From: https://www.cnblogs.com/zxc3360655/p/17255580.html

相关文章

  • VLAN常用命令
    [SW2]displayportvlanactiveT=TAGU=UNTAG-------------------------------------------------------------------------------PortLinkTypePV......
  • JSTL——JSP标准标签库
          ......
  • Android开发-Android常用组件-TextView文本框
    04   常用组件4.1 TextViewTextView(文本框),用于显示文本的一个控件。文本的字体尺寸单位为sp:sp:scaledpixels(放大像素).主要用于字体显示。文本......
  • IDEA常用操作汇总
    1.IDEA常用快捷键1)删除当前行,默认是ctrl+Y自己配置ctrl+d2)复制当前行,自己配置ctrl+alt+向下光标3)补全代码alt+/4)添加注释和取消注释ctrl......
  • 收集C#常用类:对图片的处理操作
    usingSystem;usingSystem.Collections;usingSystem.IO;usingSystem.Drawing;usingSystem.Drawing.Imaging;usingSystem.Drawing.Drawing2D;namespace******{......
  • 快速掌握 机器学习(Machine Learning) 常用概念术语,常用算法
    1、什么是机器学习?机器学习的概念:传统上如果我们想让计算机工作,我们给它一串指令,然后它遵照这个指令一步步执行下去。有因有果,非常明确。这样的方式计算机是无法执行固定流......
  • 常用的网站集合
    科学网博客:https://blog.sciencenet.cn/blog.php书签中国:非常有用:https://www.bookmarkearth.com/CSDN:https://www.csdn.net/论文&电子书免费下载:https://www.cnblogs.......
  • Ubuntu常用命令
    软件安装&卸载sudoaptinstall<软件名>//安装软件最简单的方式sudoaptlist//查看所有已安装的软件列表sudoaptsearch<软件名>/......
  • 初识JSON、JSON的3种形式、JSON的常用方法
    初识JSONJSON是什么Ajax发送和接收数据的一种格式XMLusername=alex&age=18JSON全称是JavaScriptObjectNotation......
  • 微信小程序常用功能:分享、转发、更新
    目标:分享微信小程序常用的功能,便于快速上手。一、分享小程序某个页面到微信好友或群聊onShareAppMessage(Objectobject)监听用户点击页面内转发按钮(button 组件 open-typ......