- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
大家好,我很抱歉我的英语不好。我搜索了很多文档,但由于我的英语,我不理解它们。我设计了测验页面,但我无法在页面末尾显示结果,并且出现问题和错误
我要:
我尝试了一些东西,但我犯了很多可怕的错误..你能帮我看看有多少问题是正确的。
我的代码 HTML
<html>
<head>
<link href="css/boostrap.css" rel="stylesheet" media="screen">
<link href="css/deneme.css" rel="stylesheet" media="screen">
<link href="css/style.css" rel="stylesheet" media="screen">
<script type="text/JavaScript" src="scripts/jquery.alerts.js"></script>
<script type="text/JavaScript" src="scripts/jquery-1.8.2.js"></script>
<script type="text/JavaScript" src="scripts/jquery.js"></script>
<script type="text/JavaScript" >
// if they click false section it gives error message
$(".alerts").on('click', function() {
var did = $(this).attr('data-id');
$(document).trigger("set-alert-id-" + did, [
{
'message': "Wrong",
'priority': 'warning'
}]);
});
// if they click true section it gives success message
$(".alerts-success").on('click', function() {
var did = $(this).attr('data-id');
$(document).trigger("set-alert-id-" + did, [
{
'message': "Success",
'priority': 'warning'
}]);
});
// I try something to show how many question is true selected but I can not do this
function askQuestion(question) {
var answer = prompt(question[0], '');
if (answer == question[1]) {
alert('Correct!');
score++;
} else {
alert('Sorry. The correct answer is ' + question[1]);
}
}
var message = 'You got ' + score;
message += ' out of ' + questions.length;
message += ' questions correct.';
document.write('<p>' + message + '</p>');
</script>
</head>
<body>
<div id="quiz_container">
<ul class="quiz_container" style="padding: 0px;">
<li class="question_container row-fluid question_0">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who said it: Newt or Schrute?</h1>
<p class="text">"Men are basically little piglets...Males are biologically driven to go out and hunt giraffes."</p>
</div>
<ul class="span12 possible_answers possible_answers_0">
<li class="possible_answer span12 answer_0 alerts" data-id="myid1">Dwight Schrute</li>
<li class="possible_answer span12 answer_1" data-id="myid11" >Newt Gingrich</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid1" data-fade="3000"></div>
<div data-alerts="alerts" data-ids="myid11" data-fade="3000"></div>
<li class="question_container row-fluid question_1">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">He said: "Can we steer away from 'gay people'? I’m sorry, it’s an orientation, not a race. Plus, a lot of other races are intolerant of gays."</p>
</div>
<ul class="span12 possible_answers possible_answers_1">
<li class="possible_answer span12 answer_0 alerts" data-id="myid2">Must be Schrute</li>
<li class="possible_answer span12 answer_1" data-id="myid2" >Totally Newt</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid2" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid22" data-fade="3000"></div>
<li class="question_container row-fluid question_2">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who said it?</h1>
<p class="text">When he was 11-years-old, he took on City Hall in an attempt to build a zoo from scratch in South Central Pennsylvania.</p>
</div>
<ul class="span12 possible_answers possible_answers_2">
<li class="possible_answer span12 answer_0" data-ids="myid3" >Lil' Schrute</li>
<li class="possible_answer span12 answer_1" data-ids="myid33">Lil' Newt</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid3" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid33" data-fade="3000"></div>
<li class="question_container row-fluid question_3">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">This man pitched a radical plan to capture Osama bin Laden using a portable prison that could be operated beyond the pale of traditional covert ops.</p>
</div>
<ul class="span12 possible_answers possible_answers_3">
<li class="possible_answer span12 answer_0" data-ids="myid4" >Gingrich idea</li>
<li class="possible_answer span12 answer_1" data-ids="myid44">Schrute idea</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid4" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid44" data-fade="3000"></div>
<li class="question_container row-fluid question_4">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who said it?</h1>
<p class="text">Publicly referred to pop star Justin Bieber as "Justice Beaver."</p>
</div>
<ul class="span12 possible_answers possible_answers_4">
<li class="possible_answer span12 answer_0" data-ids="myid55" >Dwight gag</li>
<li class="possible_answer span12 answer_1" data-ids="myid5" >Newt gaffe</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid5" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid55" data-fade="3000"></div>
<li class="question_container row-fluid question_5">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">When debating the eating habits of T-Rex's, this man explained, "I believe [the T-Rex] was a predator because I saw 'Jurassic Park' and he ate a lawyer and it wasn't a dead lawyer."</p>
</div>
<ul class="span12 possible_answers possible_answers_5">
<li class="possible_answer span12 answer_0">Totally Newt</li>
<li class="possible_answer span12 answer_1" data-ids="myid6" >Definitely Schrute</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid6" data-fade="3000"></div>
<li class="question_container row-fluid question_6">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">When thrown a softball question about past "romantic" activities, he mumbled something about "chicken fights."</p>
</div>
<ul class="span12 possible_answers possible_answers_6">
<li class="possible_answer span12 answer_0" data-ids="myid77" >Dwight Schrute</li>
<li class="possible_answer span12 answer_1" data-ids="myid7" >Newt Gingrich</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid7" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid77" data-fade="3000"></div>
<li class="question_container row-fluid question_7">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">He fantasized about ditching the drudgery of the workplace to spend a year in the Amazon, staring at sloths.</p>
</div>
<ul class="span12 possible_answers possible_answers_7">
<li class="possible_answer span12 answer_0" data-ids="myid88">Must be Newt</li>
<li class="possible_answer span12 answer_1" data-ids="myid8" >Has to be Schrute</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid8" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid88" data-fade="3000"></div>
<li class="question_container row-fluid question_8">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">As recently as 2009, he called the Swedish system of governement and healthcare "communist" and repressive.</p>
</div>
<ul class="span12 possible_answers possible_answers_8">
<li class="possible_answer span12 answer_0" data-ids="myid99">Schrute</li>
<li class="possible_answer span12 answer_1" data-ids="myid9" >Newt</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid9" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid99" data-fade="3000"></div>
<li class="question_container row-fluid question_9">
<div class="question span12 show" style="overflow: hidden; position: relative;">
<h1 class="title">Who was it?</h1>
<p class="text">His favorite childhood game was curling up into a ball and playing dead on the sidewalk.</p>
</div>
<ul class="span12 possible_answers possible_answers_9">
<li class="possible_answer span12 answer_0">
Kid Schrute
<br>
<img data-ids="myid100" src="../ckeditor/rainn-kid.png">
</li>
<li class="possible_answer span12 answer_1">
Kid Newt
<br>
<img data-ids="myid10" src="../ckeditor/newt-kid.png">
</li>
</ul>
</li>
<div data-alerts="alerts" data-ids="myid10" data-fade="3000"></div>
<div data-alerts="alerts-success" data-ids="myid100" data-fade="3000"></div>
</ul>
<p class="how_you_did">
<span>You got </span>
<span class="correct_answers">0</span>
<span> correct answers out of 10 questions</span>
</p>
<p class="small">on your first attempt. No fair changing your answers after you found out you were wrong</p>
</div>
</body>
</html>
CSS 代码
.quiz_container {
list-style-type: none !important;
font-weight: bold;
color: #21252E;
width: 98%;
}
/*fluid grid layout using twitter bootstrap */
.row-fluid {
margin-left: 0 !important;
}
.span12 {
padding: .75em;
margin-top: .75em;
margin-left: 0 !important;
}
.span12.question {
padding: 0;
}
/*additional custom styling*/
.quiz_container .question_container {
margin: 1em 0em 6em;
}
.quiz_container .question_container h1, .question p, .revealed_answer p {
line-height: 1.5em;
}
.quiz_container .question_container h1 {
font-size: 1.5em;
font-weight: bold;
margin: 0em 0em 1em 0em;
}
.quiz_container .question p {
font-size: 1.5em;
max-height: 8em;
}
.quiz_container .possible_answers.span12 {
padding: 0;
margin: 0;
}
.quiz_container .possible_answer {
background: rgba(254, 231, 88, .2);
margin-left: 0 !important;
border-radius: 2px;
list-style-type: none;
}
.quiz_container .possible_answer:hover {
background: rgba(254, 231, 88, 1);
cursor: pointer;
color: #000;
}
.quiz_container li {
list-style-type: none !important;
}
/*more styling for answers*/
.quiz_container .revealed_answer p {
font-size: 1.2em;
line-height: 1.5em;
padding: 0em 0 0 0;
margin: 0;
min-height: 3em;
font-weight: normal;
}
.quiz_container .revealed_answer a {
color: #E64522;
border-bottom: 0 !important;
}
.quiz_container .revealed_answer a:hover {
opacity: .75;
text-decoration: none;
}
.quiz_container .correct_answer {
background: #62DA97;
opacity: .5;
cursor: pointer;
}
.quiz_container .wrong_answer {
background: #FF8362;
opacity: .5;
cursor: pointer;
}
.quiz_container .selected {
opacity: 1;
color: black;
}
.quiz_container .selected:hover, .correct_answer:hover, .wrong_answer:hover {
opacity: 1;
}
.quiz_container .hide {display: none;}
.quiz_container .show {display: block;}
.quiz_container .revealed_answer {
padding: 0;
}
#quiz_container .how_you_did {
text-align: center;
padding: 1em;
background-color: rgb(254, 231, 88);
font-weight: bold;
font-size: 1.25em;
-webkit-box-shadow: 0px 7px 5px rgba(50, 50, 50, 0.65);
-moz-box-shadow: 0px 7px 5px rgba(50, 50, 50, 0.65);
box-shadow: 0px 7px 5px rgba(50, 50, 50, 0.65);
}
/*multimedia styling*/
.quiz_container img, .quiz_container .youtube {
margin-bottom: 1em;
min-height: 200px;
max-height: 200px;
}
.quiz_container .possible_answer img {
max-height: 18em;
}
.quiz_container .question img, .revealed_answer img, .selected img, .correct_answer img, .wrong_answer img {
max-height: 18em;
display: block;
}
.videoembed {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.videoembed iframe, .videoembed object, .videoembed embed {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
/* media queries */
@media (max-width: 480px) {
.quiz_container li {
font-size: 1em !important;
}
.quiz_container .question_container h1 {
font-family: verdana, sans-serif;
font-size: 1.25em;
}
.quiz_container .question img, .revealed_answer img {
display: none;
}
.quiz_container .question_container {
margin: 1em 0em 3.5em;
}
}
最佳答案
在 http://jsfiddle.net/LaB92/1/ 查看我的代码
我删除了你的 css 和 bootstrap 所以添加你自己的 CSS 让它看起来漂亮
解决问题
每个问题都包含在“LI - .single_question”<li class="single_question">
中
.single_question 包含正确答案作为属性 -
<li class="single_question" data-correct-answer="OPTION VALUE"></li>
data-question-id
是附加属性(我没有使用它,但你以后可能需要它)
将您的选项输入 <ul class="options"></ul>
不要忘记添加 li 值 - <li value="OPTION VALUE"> SOME OPTION TEXT </li>
个人成绩自动写入<div class="result"></div>
.每个问题都应该有它
当您选择一个选项时 score_calculator()
调用函数并计算分数
如果您不理解代码或者您是否想稍微扩展一下功能,请问我。我写了基本的..
关于javascript - 计算测验结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20859746/
SQL 和一般开发的新手,我有一个表(COUNTRIES),其中包含字段(INDEX、NAME、POPULATION、AREA) 通常我添加一个客户端(Delphi)计算字段(DENSITY)和 On
我想使用 calc(100%-100px),但在我的 demo 中不起作用由于高度只接受像素,因此如何将此百分比值转换为像素。 最佳答案 以下将为您提供高度: $(window).height();
我正在尝试在 MySQL 中添加列并动态填充其他列。 例如我有一张表“数字”并具有第 1 列、第 2 列、第 3 列,这些总数应填充在第 4 列中 最佳答案 除非我误解了你的问题,否则你不只是在寻找:
我想返回简单计算的结果,但我不确定如何执行此操作。我的表格如下: SELECT COUNT(fb.engineer_id) AS `total_feedback`, SUM(fb.ra
我一直在尝试做这个程序,但我被卡住了,我仍然是一个初学者,任何帮助将不胜感激。我需要程序来做 打印一个 10 X 10 的表格,其中表格中的每个条目都是行号和列号的总和 包含一个累加器,用于计算所有表
这个计算背后一定有一些逻辑。但我无法得到它。普通数学不会导致这种行为。谁能帮我解释一下原因 printf ("float %f\n", 2/7 * 100.0); 结果打印 1.000000 为什么会
我想计算从 0 到 (n)^{1/2} - 1 的数字的 AND每个数字从 0 到 (n)^{1/2} - 1 .我想在 O(n) 中执行此操作时间,不能使用 XOR、OR、AND 运算。 具体来说,
如何在 Excel 中将公式放入自定义数字格式?例如(出于说明目的随机示例), 假设我有以下数据: 输入 输出 在不编辑单元格中的实际数据的情况下,我想显示单元格中的值除以 2,并保留两位小数: 有没
每次我在 Flutter 应用程序中调用计算()时,我都会看到内存泄漏,据我所知,这基本上只是一种生成隔离的便捷方法。我的应用程序内存占用增加并且在 GC 之后永远不会减少。 我已将我的代码简化为仅调
我有数字特征观察 V1通过 V12用于目标变量 Wavelength .我想计算 Vx 之间的 RMSE列。数据格式如下。 每个变量“Vx”以 5 分钟的间隔进行测量。我想计算所有 Vx 变量的观测值
我正在寻找一种使用 C 语言计算文件中未知字符数的简单方法。谢谢你的帮助 最佳答案 POSIX 方式(可能是您想要的方式): off_t get_file_length( FILE *file ) {
我正在使用 Postgres,并且我正试图围绕如何在连续日期跨度中得出第一个开始日期的问题进行思考。例如 :- ID | Start Date | End Date =================
我有一个订单表格,我在其中使用 jQuery 计算插件来汇总总数。 此求和工作正常,但生成的“总和”存在问题。总之,我希望用逗号替换任何点。 代码的基础是; function ($this) {
我在使用 double 变量计算简单算术方程时遇到问题。 我有一个具有 double 属性 Value 的组件,我将此属性设置为 100。 然后我做一个简单的减法来检查这个值是否真的是 100: va
我在这里看到了一些关于 CRC 32 计算的其他问题。但没有一个让我满意,因此是这样。 openssl 库是否有任何用于计算 CRC32 的 api 支持?我已经在为 SHA1 使用 openssl,
当我在PHP日期计算中遇到问题时,我感到惊讶。 $add = '- 30 days'; echo date('Y-m-01', strtotime($add)); // result is 2017-
我正在使用 javascript 进行练习,我编写了这个脚本来计算 2 个变量的总和,然后在第三个方程中使用这个总和!关于如何完成这项工作的任何想法都将非常有用! First Number:
我有一个来自EAC的提示单和一个包含完整专辑的FLAC文件。 我正在尝试制作一些python脚本来播放文件,因为我需要能够设置在flac文件中开始的位置。 如何从CueSheet格式MM:SS:FF转
这个问题已经有答案了: Adding two numbers concatenates them instead of calculating the sum (24 个回答) 已关闭去年。 我有一个
4000 我需要上面字段 name="quantity" 和 id="price" 中的值,并使用 javascript 函数进行计算,并将其显示在字段 id= 中仅当我单击计算按钮时才显示“总
我是一名优秀的程序员,十分优秀!