springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 13:40:57
154
我想用其他东西来改变HTML中按钮的onClick方法,以避免使用onClick.我在网上找到了AddEventListener,但不确定如何在这里替换?下面是我的代码:
function leapYear() {
let input = document.getElementById("year");
let year = parseInt(input.value);
console.log(year);
let output = document.getElementById("output");
year = (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0);
output.innerHTML = 'Year ' + year + '. is' + (year ? '' : ' not') + ' leap year.';
}
<代码><;!文档类型HTML>;<;HTML Lang=“ en ”>;<;头部>;<;元字符集=“ UTF-8 ”>;<;meta HTTP-equiv=“ X-ua-compatible ” content=“ ie=edge ”>;<;meta name=“ viewport ” content=“ width=device-width,initial-scale=1.0 ”>;<;标题>;文档<;/标题>;<;/标题>;<;身体>;<;H1>;闰年<;/H1>;<;P>;输入年份:<;/p>;<;细分(>;)<;输入ID=“年” type=“ text ” size=“ 24 ”/>;<;button onclick=“闰年()”>;检查闰年<;/button>;<;br/>;<;SPAN ID=“ output ”>;<;/SPAN>;<;/DIV>;<;script SRC=“ leap year.JS ”>;<;/script>;<;/正文>;<;/HTML>;
顺晟科技:
将<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Leap Years</h1>
<p>Type a year:</p>
<div>
<input id="year" type="text" size="24" />
<button onclick="leapYear()">Check leap year</button> <br />
<span id="output"></span>
</div>
<script src="LeapYear.js"></script>
</body>
</html>
的第一个参数设置为addEventListener
,将第二个参数设置为函数:
'click'
<代码><;!文档类型HTML>;<;HTML Lang=“ en ”>;<;头部>;<;元字符集=“ UTF-8 ”>;<;meta HTTP-equiv=“ X-ua-compatible ” content=“ ie=edge ”>;<;meta name=“ viewport ” content=“ width=device-width,initial-scale=1.0 ”>;<;标题>;文档<;/标题>;<;/标题>;<;身体>;<;H1>;闰年<;/H1>;<;P>;输入年份:<;/p>;<;细分(>;)<;输入ID=“年” type=“ text ” size=“ 24 ”/>;<;button>;检查闰年<;/button>;<;br/>;<;SPAN ID=“ output ”>;<;/SPAN>;<;/DIV>;<;script SRC=“ leap year.JS ”>;<;/script>;<;/正文>;<;/HTML>;
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11