Lesen Sie es einfach selbst, bitte geben Sie mir einen Rat. Ich habe das vor ein paar Monaten geschrieben, jetzt werde ich alles klären.
Kopieren Sie den Codecode wie folgt:
<!doctype html>
<html>
<Kopf>
<meta charset="utf-8" >
<title></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<style type="text/css">
body,div,a,span{margin:0;padding:0;}
.g-pt-10{ padding-top:10px }
.g-ta-c{ text-align:center }
.g-fz-16{ Schriftgröße:16px }
.gdb{ display:block }
.gfl{ float:left }
.gcw{ color:#fff }
.g-fz-18{ Schriftgröße:18px }
.gd-ib{ display:inline-block }
.g-cf:after { content:""; clear:both display:table }
.g-cf { zoom:1 }
a:hover{ text-decoration:none; color:#ff0000 }
.box{ width:705px; height:242px; margin:50px back;
div.mid{ width:330px; margin:20px auto;
a.support{ width:124px; height:73px; background:#008DCA url("support.png");
a.oppose{ width:124px; height:73px; background:#F78106 url("oppose.png");
.g-mt-45{ margin-top:45px }
span.line{ width:380px; height:17px; margin:0 auto;
span.line2{ width:80px; height:17px; background:#F78106;
</style>
</head>
<Körper>
<div>
<h3>Was werden Sie tun, wenn WeChat Gebühren erhebt? </h3>
<div>
<a onclick="support();">
<p id="supamount">0</p>
</a>
<a onclick="oppose();">
<p id="oppamount">0</p>
</a>
</div>
<div>
<p id="suppercent">0</p>%
<span><span id="supline"></span></span>
<p id="opppercent">0</p>%
</div>
</div>
<script type="text/javascript">
var sup=parseInt($('#supamount').text());
var opp=parseInt($('#oppamount').text());
Funktionsunterstützung(){
sup+=1;
$('#supamount').text(sup.toString());
$('#suppercent').text(((sup/(sup+opp))*100).toFixed(0).toString());
$('#opppercent').text((100-(sup/(sup+opp))*100).toFixed(0).toString());
$('#supline').attr("style","width:"+380*(sup/(sup+opp))+"px");
}
Funktion oppose(){
opp+=1;
$('#oppamount').text(opp.toString());
$('#suppercent').text(((sup/(sup+opp))*100).toFixed(0).toString());
$('#opppercent').text((100-(sup/(sup+opp))*100).toFixed(0).toString());
$('#supline').attr("style","width:"+380*(sup/(sup+opp))+"px");
}
</script>
</body>