国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

使用js寫的一個簡易的投票

2024-05-06 15:56:18
字體:
來源:轉載
供稿:網友
投票想必大家并不陌生吧,下面為大家介紹下使用js是如何寫一個簡易的投票

大家直接自己看吧,請多多指教,這個是幾個月前寫的,現在全部整理一下。

復制代碼 代碼如下:


<!doctype html>
<html>
<head>
<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{ font-size:16px; }
.g-d-b{ display:block; }
.g-f-l{ float:left; }
.g-c-w{ color:#fff; }
.g-fz-18{ font-size:18px; }
.g-d-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 auto; background:#f5f9fe; border:1px solid #6888a1; }
div.mid{ width:330px; margin:20px auto; }
a.support{ width:124px; height:73px; background:#008DCA url("support.png"); margin-right:80px; }
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; background:#008DCA; }
span.line2{ width:80px; height:17px; background:#F78106; }

</style>
</head>
<body>

<div>
<h3>如果微信將會進行收費,你將會怎么辦?</h3>
<div>
<a>
<p>0</p>
</a>
<a>
<p>0</p>
</a>
</div>
<div>
<p>0</p>%
<span><span></span></span>
<p>0</p>%
</div>
</div>
<script type="text/javascript">
var sup=parseInt($('#supamount').text());
var opp=parseInt($('#oppamount').text());

function support(){
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");
}
function 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>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 吉林省| 新龙县| 新津县| 广宗县| 淮南市| 屏边| 壶关县| 黑水县| 日照市| 孟村| 乳山市| 阿尔山市| 综艺| 赣州市| 新安县| 咸阳市| 博客| 临潭县| 乌海市| 东城区| 醴陵市| 兴山县| 盐城市| 临江市| 宜兰县| 江西省| 益阳市| 尉氏县| 仙游县| 扎鲁特旗| 腾冲县| 安庆市| 湘乡市| 奉新县| 屯昌县| 沂源县| 河西区| 大安市| 松滋市| 余庆县| 五大连池市|