调查中的排名首选项 [英] Rank Preferences in a Survey

查看:63
本文介绍了调查中的排名首选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在创建一个在线调查。我希望用户有一个

选项列表,其中包括10个单选项按钮。他们需要对他们的优惠进行排名。他们点击偏好1,该选项从

顶部列表(选项)中删除,并显示在名为'你的

偏好''的列表下方,你继续循环直到你的所有偏好都被制作出来。

这有意义吗?


如何用Javascript设置它?


任何帮助表示赞赏。


可以


***通过Developersdex发送 http://www.developersdex.com ***

解决方案

"可" < CH *** @ hotmail.com>在消息中写道

新闻:VT ************** @ news.uswest.net ...


我我正在创建一个在线调查。我希望用户有一个选项的列表,其中包括10个单选项按钮。他们需要对他们的偏好进行排名。他们点击首选项1,该选项将从
顶部列表(选项)中删除,并显示在名为您的
首选项的列表下方,您将一直循环直到完成所有首选项。
这有意义吗?

如何使用Javascript进行设置?

感谢任何帮助。

可以




这种方法怎么样呢?请注意自动换行。


< html>

< head>

< title> 10rank.htm< / title>

< script type =" text / javascript">

var op;

function rank(bool){

var form = document.forms [" form1"];

if(bool){

for(var i = 0; i< 10; i ++){

form.s1.options [i] =新选项(i + 1,i + 1);

form.s2.options [i] = null;

}

op = 0;

} else {

var indx = form.s1。 selectedIndex;

if(indx< 0)return;

var text = form.s1.options [indx] .text;

var valu = form.s1.options [indx] .value;

form.s1.options [indx] = null;

form.s2.options [op ++] = new选项(文字,价值);

}

}

< / script>

<样式类型=" text / css">

..sel1 {width:30px}

..sel2 {width:30px;背景:#EFEFEF; font-weight:bold}

< / style>

< / head>

< body onload =" rank(true )">

< form action =""方法= QUOT;获得" name =" form1">

< select name =" s1"大小= QUOT; 10"类= QUOT; SEL1" onclick =" rank(false)"

< / select>

< select name =" s2"大小= QUOT; 10"类= QUOT; SEL2"已停用>

< / select>

< input type =" button"值= QUOT;复位" onclick =" rank(true)">

< / form>

< / body>

< / html> ;


谢谢你,我在一个我可以看到的网站上有一个样本,在视觉上我想看看结果会是什么。


可以

***通过Developersdex发送 http://www.developersdex.com ***


" Can" < CH *** @ hotmail.com>在留言中写道

新闻:12 *************** @ news.uswest.net ...

谢谢,你呢在我可以看到的网站上有一个样本,在视觉上我想看看结果会是什么。

可以



测试它原样。将其保存为10rank.htm (或其他)点击它。



I am creating an on-line survey. I want the user to have a list of
choices of say 10 items that are radio buttons. They need to rank their
preference. They click on preference 1, that option is removed from the
top list (choices) and appears below in a list called ''Your
preferences'', you keep looping until all of your preferences are made.
Does this make sense?

How to I set it up with Javascript?

Any help is appreciated.

Can

*** Sent via Developersdex http://www.developersdex.com ***

解决方案

"Can" <ch***@hotmail.com> wrote in message
news:VT**************@news.uswest.net...


I am creating an on-line survey. I want the user to have a list of
choices of say 10 items that are radio buttons. They need to rank their
preference. They click on preference 1, that option is removed from the
top list (choices) and appears below in a list called ''Your
preferences'', you keep looping until all of your preferences are made.
Does this make sense?

How to I set it up with Javascript?

Any help is appreciated.

Can



How about this approach instead? Watch for word-wrap.

<html>
<head>
<title>10rank.htm</title>
<script type="text/javascript">
var op;
function rank(bool) {
var form = document.forms["form1"];
if (bool) {
for (var i=0; i<10; i++) {
form.s1.options[i] = new Option(i+1, i+1);
form.s2.options[i] = null;
}
op = 0;
} else {
var indx = form.s1.selectedIndex;
if (indx < 0) return;
var text = form.s1.options[indx].text;
var valu = form.s1.options[indx].value;
form.s1.options[indx] = null;
form.s2.options[op++] = new Option(text, valu);
}
}
</script>
<style type="text/css">
..sel1 { width:30px }
..sel2 { width:30px; background:#EFEFEF; font-weight:bold }
</style>
</head>
<body onload="rank(true)">
<form action="" method="get" name="form1">
<select name="s1" size="10" class="sel1" onclick="rank(false)">
</select>
<select name="s2" size="10" class="sel2" disabled>
</select>
<input type="button" value="Reset" onclick="rank(true)">
</form>
</body>
</html>


Thanks, do you have a sample on a website I could look at, visually I
would like to see what the result would be.

Can
*** Sent via Developersdex http://www.developersdex.com ***


"Can" <ch***@hotmail.com> wrote in message
news:12***************@news.uswest.net...

Thanks, do you have a sample on a website I could look at, visually I
would like to see what the result would be.

Can


Test it as-is. Save it as "10rank.htm" (or whatever) and click on it.


这篇关于调查中的排名首选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆