用户:
WMoSo岛同号查看:2 回复:4 评论:2 创建时间:2022-08-16T15:42:38
<!doctype html>
<head>
<meta charset="utf-8">
<title>你个**a</title>
</head>
<body>
<script type="text/javascript">
function Car(name,power,max){
this.name=name;
this.power=power;
this.max=max;
this.e_power=100;
this.oil_power=5;
this.powerin=powerin();
}
function powerin(){
if(this.power=='e'){
document.write(`充满电需要${this.e_power*this.max}小时`)
}
else{
document.write(`加满油需要${this.oil_power*this.max}小时`)
}
}
var fld=new Car('法拉利','e',9);
//fld.powerin();
console.log('okook')
//document.write(fld.max);
</script>
</body>
谁教教我怎么回事啊?为什么效果是这样?↓

怎么办啊啊啊啊啊啊啊啊啊啊啊啊!!!!!
这个html是有问题吧?!
<!doctype html>
<head>
<meta charset="utf-8">
<title>你个**a</title>
</head>
<body>
<script type="text/javascript">
function Car(name,power,max){
this.name=name;
this.power=power;
this.max=max;
this.e_power=100;
this.oil_power=5;
this.powerin=powerin;
}
function powerin(){
if(this.power=='e'){
document.write(`充满电需要${this.e_power*this.max}小时`)
}
else{
document.write(`加满油需要${this.oil_power*this.max}小时`)
}
}
var fld=new Car('法拉利','e',9);
fld.powerin();
console.log('okook')
//document.write(fld.max);
</script>
</body>点赞0
评论
WMoSo岛同号诶嘿嘿嘿我改过来了~
<!doctype html>
<head>
<meta charset="utf-8">
<title>你个?!a</title>
</head>
<body background="封面.jpeg">
<link rel="stylesheet" href="nb.css">
<h1>欢迎使用老神牌能源辅助系统(doge)</h1>
<h2>Warning:此处显示的数据均为四舍五入后结果,可能和真实结果有一些误差</h2>
<h2>特别提示:此处使用的算法仅为平均值,请按实际情况判断(尤其是汽油车)</h2>
<h3>那么,开始咯!</h3>
<form id="get" name="form" method="post" action="">
车型:<input type="text" name="carname" size="20"><br>
能源:<input type="text" name="energy" size="20"><br>
油箱/电池容量(油箱以升为单位,电池以千瓦时为单位):<input type="text" name="kwh" size="20"><br>
<input type="submit" name="upload" value="确认提交">
</form>
<script type="text/javascript">
function Car(name,power,max){
this.name=name;
this.power=power;
this.max=max;
this.e_power=100;
this.oil_power=5;
this.powerin=function(){
if(this.power=='e'){
document.write(`这辆${this.name}充满电需要${Math.round(this.max*0.1428)}小时(220v交流电)`)
}
else{
document.write(`这辆${this.name}加满油需要${Math.round(max/40)}分钟(45L油嘴)`)
}
}
}
//function powerin(){
//}
var fld=new Car('法拉利','e',60);
fld.powerin();
//document.write(fld.max);
</script>
</body>点赞0
评论