<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form class="ul_none">
<div class="lable_input">
<label>选择</label>
<select id="select1" onclick="xianshi()">
<option value="C币">C币</option>
<option value="金币">金币</option>
<option value="钻石">钻石</option>
</select>
</div>
<div class="lable_input">
<label>输入</label>
<input type="number" id="shuru" value="100" min="10" onkeyup="xianshi()" />
</div>
<div class="lable_input">
<label>获得</label>
<select id="select2" onclick="xianshi()">
<option value="金币">金币</option>
<option value="钻石">钻石</option>
<option value="C币">C币</option>
</select>
</div>
<div class="lable_input">
<label>结果</label>
<input type="text" id="jieguo" placeholder="请在输入框输入兑换的数量" readonly="readonly" value="" />
</div>
<input type="button" value="确定" onclick="baocun()" />
</form>
<script type="text/javascript">
var shuru=document.getElementById("shuru");
var jieguo=document.getElementById("jieguo");
var sct1=document.getElementById("select1");
var sct2=document.getElementById("select2");
function xianshi(){
if(sct1.value!=sct2.value){
if(sct1.value=="C币"){
if(sct2.value=="金币"){
jieguo.value=shuru.value/100;
console.log( "C币兑换金币", shuru.value, jieguo.value,sct1.value,sct2.value)
}
if(sct2.value=="钻石"){
jieguo.value=shuru.value/10000;
console.log("C币兑换钻石",shuru.value, jieguo.value,sct1.value,sct2.value)
}
}
if(sct1.value=="金币"){
if(sct2.value=="C币"){
jieguo.value=shuru.value*100;
console.log("金币兑换C币",shuru.value, jieguo.value,sct1.value,sct2.value)
}
if(sct2.value=="钻石"){
jieguo.value=shuru.value/100;
console.log("金币兑换钻石",shuru.value, jieguo.value,sct1.value,sct2.value)
}
}
if(sct1.value=="钻石"){
if(sct2.value=="C币"){
jieguo.value=shuru.value*10000;
console.log("钻石兑换C币",shuru.value, jieguo.value,sct1.value,sct2.value)
}
if(sct2.value=="金币"){
jieguo.value=shuru.value*100;
console.log("钻石兑换金币",shuru.value, jieguo.value,sct1.value,sct2.value)
}
}
}else{
jieguo.value=shuru.value;
}
return jieguo.value;
}
function baocun(){}
</script>
</body>
</html>
警告提示:
[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
2 个回复
1***@qq.com
您好,您这个问题解决了吗
1***@qq.com
安装 npm i default-passive-events -S
2.main.js中加入:import 'default-passive-events'