Welcome, Guest
Username: Password: Remember me

TOPIC: Is there some wrong?

Is there some wrong? 2 years 6 months ago #76191

  • lewisrx
  • lewisrx's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
There is four type cars,I want to caculate how many people have speciel cars more than one,I design an Array (5 point choice) question so that people can select 1 or 2 or 3...for every tpye,but it did not work.
It is my first time to use javascript in limesurvey,and I have read the docs and searched in this forum,for my poor english,I still can not find the answer.Is there something wrong?
<script type="text/javascript" charset="utf-8"> 
$(document).ready(function(){
var mycars=new Array();
mycars[0]={INSERTANS:66175X7X133Q1};
mycars[1]={INSERTANS:66175X7X133Q2};
mycars[2]={INSERTANS:66175X7X133Q3};
mycars[3]={INSERTANS:66175X7X133Q4};
var num=0;
for (x in mycars)
{
   document.write(mycars[x]);
   if(mycars[x]>1)
   num=num+1;
}
document.write(num);
}
Last Edit: 2 years 6 months ago by lewisrx.
The administrator has disabled public write access.

Re: Is there some wrong? 2 years 6 months ago #76193

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Using 1.92, you could do the following. Say your question is called q1, and you have four sub-questions A-D, you could add a Equation question type to compute the value you want.
{sum(q1_A>1, q1_B>1, q1_C>1, q1_D>1)}
The administrator has disabled public write access.
The following user(s) said Thank You: lewisrx

Re: Is there some wrong? 2 years 6 months ago #76196

  • lewisrx
  • lewisrx's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Thank you very much!!!
The administrator has disabled public write access.

Aw: Is there some wrong? 2 years 6 months ago #76285

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
You're welcome :-)

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.155 seconds
Donation Image