Java教程

常用Java、css、js等

本文主要是介绍常用Java、css、js等,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1.如何隐藏一个FORM里的input?
隱藏了,但會佔位置

<input type=text style="visibility:hidden">

隱藏了,但不會佔位置

<input type=text style="display:none">

2.只能输入数字,不能输入小数点

oninput="value=value.replace(/[^0-9]/g,'')"

3.通过div指定css设置一块嵌套区域

.divBottom {
    position: inherit;
    max-height: 100%;
    overflow-y: auto;
    background-color: #f9f9f9;
    bottom: 0;
    border-radius: 26px 26px 0 0;
    height: 500px;
    margin-left: 10px;
    width: 95%;
}
.doctorEval {
    position: inherit;
    max-height: 100%;
    overflow-y: auto;
    background-color: #ddffda;
    bottom: 0;
    border-radius: 0px 2px 0 0;
    margin-left: 14px;
    width: 93%;
    margin-top: 0px;
}
<div class="divBottom">
	<div class="doctorEval">
	</div>
</div>

4.设置cookie
导入:

import CryptoJS from "crypto-js"
import Cookies from 'js-cookie'

获取:

const basicId = Cookies.get("basicId");

存入:
Cookies.set(TokenKey, token)

setCookie(c_idCard, c_pwd, exdays) {
const text = CryptoJS.AES.encrypt(c_pwd, this.key);
const exdate = new Date();
exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays);
//字符串拼接cookie
window.document.cookie =
  "idCard" + "=" + c_idCard + ";path=/;expires=" + exdate.toGMTString();
window.document.cookie =
  "userPwd" + "=" + text + ";path=/;expires=" + exdate.toGMTString();
},
getCookie: function () {
if (document.cookie.length > 0) {
  const arr = document.cookie.split("; ");
  for (let i = 0; i < arr.length; i++) {
	const arr2 = arr[i].split("=");
	if (arr2[0] === "idCard") {
	  this.ruleForm.idCard = arr2[1];
	} else if (arr2[0] === "userPwd") {
	  const bytes = CryptoJS.AES.decrypt(arr2[1].toString(), this.key);
	  const plaintext = bytes.toString(CryptoJS.enc.Utf8);
	  this.ruleForm.password = plaintext;
	}
  }
}
},

//清除cookie

clearCookie: function () {
	this.setCookie("", "", -1);
},

5.js通过name设置值

$("input[name='inspectionValue']").val("1")

6.设置圆弧,为border-radius分别指定水平和竖直弯曲程度
其中border-radius: 10% 25% 40% 50%;可以写成以下形式:

border-top-left-radius: 10%;
border-top-right-radius: 25%;
border-bottom-right-radius: 40%;
border-bottom-left-radius: 50%;
.van-cell__value {
    position: relative;
    overflow: hidden;
    color: #969799;
    text-align: right;
    vertical-align: middle;
    word-wrap: break-word;
}.van-cell__label {
    margin-top: 4px;
    color: #969799;
    font-size: 12px;
    line-height: 18px;
}

Java:
1、oracle匹配日期查询

apply("CREATED_TIME LIKE TO_DATE({0}, 'yyyy-MM-dd')", localDate)

2、Java7ArrayList集合转数组
1.强转

String[] arrayResult = (String[]) list.toArray(new String[list.size()]);

2.Arrays.copyOf方法

Object[] inspectionValueObjs = list.toArray();
Arrays.copyOf(inspectionValueObjs, inspectionValueObjs.length, String[].class)

3.日期

String localDate = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now());

Oracle查询字段类型、字段名称、字段值大小SQL:

SELECT
	t.COLUMN_NAME,
	t.DATA_TYPE,
	t.DATA_LENGTH,
	c.COMMENTS 
FROM
	user_tab_columns t,
	user_col_comments c 
WHERE
	t.table_name = c.table_name 
	AND t.column_name = c.column_name 
	AND t.table_name = 'QC_BASIC_INFO' 
	ORDER BY t.COLUMN_ID;
SELECT
	t.COLUMN_NAME,
	t.DATA_TYPE,
	t.DATA_LENGTH,
	t.NULLABLE,
	t.COLUMN_ID,
	c.COMMENTS 
FROM
	user_tab_columns t,
	user_col_comments c 
WHERE
	t.table_name = c.table_name 
	AND t.column_name = c.column_name 
	AND t.table_name = 'SYS_DICT' 
ORDER BY
	t.COLUMN_ID;
这篇关于常用Java、css、js等的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!