导航:首页 > 万维百科 > 网页设计投票

网页设计投票

发布时间:2020-11-13 03:16:36

1、用php制作一个网页来实现简易网上投票系统

html 用单选按钮做,然后提交到 php页面然后存入数据库。
最简单的数据库可以 | id |项目| |是否投票
储存的时候就是存一个项目名称和一个投票 如果投票就录入1 id自动生成就可以

查看结果用php 查询数据库
就直接查询条件是项目名称 查询内容是否投票,然后根据查询出来的个数来确定该项目投了多少票
然后显示出来

2、想在微博上做个投票怎么弄?

1、电脑打开新浪微博,然后登录个人账号。


2、登录微博账号后,在发博文的地方,点击三专点,然属后选择投票。


3、点击发起投票后,选择文字或者图片投票。


4、点击发起文字投票后,输入标题,然后输入投票选项。


5、都设置好之后,点击发起。


6、点击发起之后,即可进行投票了。

3、求助:用C#制作一个投票网页

C#只是一种语言,一种面向对象的语言,你说的大概是个投票系统之类的吧,实现很简单的。选择一个IDE开发,既然你选择C#语言,最好选择微软的VS2005、2008。具体实现方法网上应该很多,自己搜索一下。
---------------------
以前写个这样的功能,限于帖子,提供主要代码,可供参考(vs 2005)。
1using System;
2using System.Data;
3using System.Configuration;
4using System.Web;
5using System.Web.Security;
6using System.Web.UI;
7using System.Web.UI.WebControls;
8using System.Web.UI.WebControls.WebParts;
9using System.Web.UI.HtmlControls;
11
12public partial class _Default : System.Web.UI.Page
13...{
14 protected void Page_Load(object sender, EventArgs e)
15 ...{
16 if (!IsPostBack)
17 ...{
18 string[] pollselect = new string[] ...{ "会", "不会", "不知道" };
19 RadioButtonList1.DataSource = pollselect;
20 RadioButtonList1.DataBind();
21 }
22 }
23 protected void Button1_Click(object sender, EventArgs e)
24 ...{
25 Response.Redirect("pollresult.aspx?result=" + RadioButtonList1.SelectedIndex.ToString());
26 RadioButtonList1.SelectedIndex = -1;
27 }
28}
29
--------------------------
1using System;
2using System.Data;
3using System.Configuration;
4using System.Collections;
5using System.Web;
6using System.Web.Security;
7using System.Web.UI;
8using System.Web.UI.WebControls;
9using System.Web.UI.WebControls.WebParts;
10using System.Web.UI.HtmlControls;
11using System.IO;

14public partial class pollresult : System.Web.UI.Page
15...{
16 float poll1ratio = 0F;
17 float poll2ratio = 0F;
18 float poll3ratio = 0F;
19
20 protected void Page_Load(object sender, EventArgs e)
21 ...{
22 Image1.Height = 15;
23 Image2.Height = 15;
24 Image3.Height = 15;
25 int i = int.Parse(Request.QueryString["result"].ToString());
26 string Path = Request.PhysicalApplicationPath + @"\App_Data\savepoll.dat";
27 if (!File.Exists(Path))
28 ...{
29 FileStream fs = File.Create(Path);
30 fs.Close();
31 BinaryWriter bw1 = new BinaryWriter(new FileStream(Path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite));
32 bw1.Write(010);
33 bw1.Write(010);
34 bw1.Write(010);
35 bw1.Close();
36
37 }
38 else
39 ...{
40 BinaryReader br = new BinaryReader(new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
41 int poll1 = br.ReadInt32();
42 int poll2 = br.ReadInt32();
43 int poll3 = br.ReadInt32();
44 if (i == 0) poll1++;
45 else if (i == 1) poll2++;
46 else if (i == 2) poll3++;
47 br.Close();
48
49 int pollsum = poll1 + poll2 + poll3;
50 poll1ratio = Convert.ToSingle((float)poll1 / pollsum);
51 lbyes.Text = Math.Round((poll1ratio * 100), 2).ToString() + "%";
52 poll2ratio = Convert.ToSingle((float)poll2 / pollsum);
53 lbno.Text = Math.Round((poll2ratio * 100), 2).ToString() + "%";
54 poll3ratio = Convert.ToSingle((float)poll3 / pollsum);
55 lbunknow.Text = Math.Round((poll3ratio * 100), 2).ToString() + "%";
56 lbsum.Text = pollsum.ToString();
57
58 Image1.Width = (int)(poll1ratio * 100);
59 Image2.Width = (int)(poll2ratio * 100);
60 Image3.Width = (int)(poll3ratio * 100);
61
62 BinaryWriter bw2 = new BinaryWriter(new FileStream(Path, FileMode.Open, FileAccess.Write, FileShare.ReadWrite));
63 bw2.Write(poll1);
64 bw2.Write(poll2);
65 bw2.Write(poll3);
66 bw2.Close();
67 }
68 }
69}
70

4、网页制作里面,网站的投票数百分比如何显示?

我以前写一个div填充颜色 div的宽度设置成动态取值 从数据库中取值之后百分百 很简单的

5、制作一个网络投票统计页面

加我好友

6、网站投票系统的投票结果页面的制作

<

7、投票网页选项太多应怎么设计?

投票完全可以放在第一页面上,那些小图标可以利用翻页的效果实现,不会占用很大的地方

8、制作一个投票的网页,有二十个选项,但是允许用户最多选十个,怎么办?

这样弹出提示窗口的判断,通常都是用计算机脚本语言来实现的。以下如果看不懂可以再问。

<script language="javascript"> //表示在IE页面上引入脚本函数

function checkTheBox() {
//……,一堆脚本函数开头的代码,这里是注释,总之选好复选后提交页面时,进入此判断函数脚本进行判断

var selectnum = 0; //为了对到底选了多少个选项做计数
var i; //为了对当前复选列表做循环
var theMain = document.form1; //document.form1可以理解为当前页面的所有内容

for(i=0; i<theMain.vote.length; i++){ //对当前复选列表做循环
//theMain.vote.length为当前页面内容里复选列表的选项数目
if(theMain.vote[i].checked == true) { //若选择了本行选项
selectnum++; //则计数一次
}
}

if (selectnum>10) { //若上面获得的已选项>你预定的10个
alert("只允许最多选择10个选项,请去掉多选的项后再提交。");
return false; //因为判断到有问题,所以不允许提交,返回一个false
}

pageSubmit(); //经过上面的判断后没发现问题,所以页面提交

…… //一堆函数结尾的代码
} //判断函数结束

//引入脚本函数结束了
</script>

以上。

与网页设计投票相关的知识