初始文档
This commit is contained in:
62
开发文档/javascript/html+css+js教程.md
Normal file
62
开发文档/javascript/html+css+js教程.md
Normal file
@@ -0,0 +1,62 @@
|
||||
text-decoration:none 去下划线
|
||||
cursor:pointer 鼠标变手型
|
||||
target="_blank" 在新页面打开连接
|
||||
rel="nofollow" 禁止爬虫爬该链接
|
||||
float 元素偏移
|
||||
rgba(0,0,0,0-1) 设置透明色
|
||||
# html用法
|
||||
|
||||
### 表单上传多文件
|
||||
```html
|
||||
<form action="url" method="POST" enctype="multipart/form-data">
|
||||
<input type="file" name="imagevideo" accept="image/jpeg,image/png,image/jpg,video/mp4,video/mpeg" multiple="multiple" disabled="disabled">
|
||||
<input type="radio" value="5" name="evaluate3" required>
|
||||
<input typed="text" placeholder="这里是提示的文字">
|
||||
<input type="text" value="默认显示值" readonly>
|
||||
</form>
|
||||
“input禁止复制粘贴 禁止复制: οncοpy="return false" 禁止粘贴: οnpaste="return false" 禁止剪切: oncut="return false" 禁止右键弹出: οncοntextmenu="return false" 关闭自动完成功能(缓存): autocomplete="off" 自动获得焦点: autofocus="autofocus" 禁用自动更正: autocorrect="off" 来关闭键盘默认首字母大写...
|
||||
```
|
||||
> + type指定类型
|
||||
> + 上传多文件必须的属性
|
||||
method="post" 请求方式
|
||||
enctype="multipart/form-data" 表单上传多文件
|
||||
multiple="multiple" 多选文件
|
||||
> + accept指定上传文件类型
|
||||
> + disabled指定元素不可选
|
||||
> + required指定字段不能为空
|
||||
> + placeholder在文本框显示提示语
|
||||
> + value在文本框显示默认值
|
||||
> + readonly文本框只读
|
||||
> + οncοpy="return false"禁止复制
|
||||
> + οnpaste="return false"禁止粘贴
|
||||
> + oncut="return false"禁止剪切
|
||||
> + onselectstart="return false"禁止被选中
|
||||
> + οncοntextmenu="return false"禁止右键弹出
|
||||
> + autocomplete="off"关闭自动完成功能(缓存)
|
||||
> + autofocus="autofocus"自动获得焦点
|
||||
> + autocorrect="off"禁用自动更正
|
||||
> + autocapitalize="off"移动端关闭键盘首字母大写
|
||||
> + spellcheck="false"不对元素的文本进行拼写检查
|
||||
|
||||
##### accept支持上传文件类型
|
||||
# JavaScript
|
||||
### 类型转换
|
||||
+ 将JavaScript任意类型转换为string类型
|
||||
> 可以用 data.toString()或String(data)方式
|
||||
|
||||
### 计算文件hash
|
||||
```javascript
|
||||
const md5 = CryptoJS.algo.MD5.create()
|
||||
// 以二进制的方式读取文件,每次读取一定字节块
|
||||
md5.update(a)
|
||||
|
||||
md5.finalize().toString(CryptoJS.enc.MD5)
|
||||
|
||||
```
|
||||
|
||||
### 生成随机数
|
||||
```JavaScript
|
||||
Math.random() //返回0-1之间的小数
|
||||
Math.round(num) //将num四舍五入
|
||||
Math.floor(Math.random()*10) //生成0-10之间的随机数
|
||||
```
|
||||
Reference in New Issue
Block a user