- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有两个跨度的文本,但它们并不相邻。 (最后一段文字在前面一段文字的下面,但应该在前面一段文字的旁边。)
这是打印文本的代码:
var display_options_1 = `
<td><span id="A${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[0]}</span><span>${question.option_text[0]}</span></td>
<td><span id="B${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[1]}</span><span>${question.option_text[1]}</span></td>`;
var display_options_2 = `
<td><span id="C${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[2]}</span><span>${question.option_text[2]}</span></td>
<td><span id="D${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[3]}</span><span>${question.option_text[3]}</td>`;
It was easier to solve the problem with one
<span>
,<span id="C${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[ ]}
${question.option_text[ ]}
, but I need only
${question.options[]}
to be selected not${question.option_text[ ]}
最佳答案
改变这些行
<td><span id="A${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[0]}</span><span>${question.option_text[0]}
<td><span id="B${i}" class="${question.questionId}" onclick="onSelect(event)">${question.options[1]}</span><span>${question.option_text[1]}
这些
<td><span onclick="onSelect(event)" class="${question.questionId}" ><span id="A${i}" >${question.options[0]}</span><span>${question.option_text[0]}</span></span>
<td><span onclick="onSelect(event)" class="${question.questionId}"><span id="B${i}" >${question.options[1]}</span><span>${question.option_text[1]}</span></span>
在 .question1
上删除 width: 90%
在选择的第一个 child 上添加锁定/正确/不正确的类,例如
selection.firstElementChild.setAttribute('class', 'locked');
同时更改检查正确答案的行
if (currentQuestion.answer === e.currentTarget.firstElementChild.innerText) {
var x;
var questions = [{
questionId: "question1",
answerId: "C",
question: "1) जो भवनों में रहते हैं, वे है ?(C186506)",
options: ["A)", "B)", "C)", "D)"],
option_text: ["ज्योतिष्क ", "वैमानिक", "भवनपति ", "व्यंतर"],
answer: "C)",
locked: false
}];
var table = document.getElementById("test");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
cell1.colSpan = 2;
var i = 0;
function generateQuestion(question) {
// noinspection JSAnnotator
i += 1;
var newQuestion = `
<td colspan="2"><div class="question1" style="justify-content: center; width: 100%;">${question.question}`;
var display_options_1 = `
<td><span onclick="onSelect(event)" class="${question.questionId}" ><span id="A${i}" >${question.options[0]}</span><span>${question.option_text[0]}</span></span>
<td><span onclick="onSelect(event)" class="${question.questionId}"><span id="B${i}" >${question.options[1]}</span><span>${question.option_text[1]}</span></span>
`;
var display_options_2 = `
<td><span onclick="onSelect(event)" class="${question.questionId}" ><span id="C${i}" >${question.options[2]}</span><span>${question.option_text[2]}</span></span>
<td><span onclick="onSelect(event)" class="${question.questionId}"><span id="D${i}">${question.options[3]}</span><span>${question.option_text[3]}</span></span>
`;
var row2 = table.insertRow(1);
row2.innerHTML = newQuestion;
var row3 = table.insertRow(2);
setTimeout(() => {
row3.innerHTML = display_options_1;
}, 2000);
var row4 = table.insertRow(3);
setTimeout(function() {
row4.innerHTML = display_options_2;
}, 2000);
var points_display = "1";
var points_set = "237512";
var t_points = "237513";
var distance = "10";
}
function onSelect(e) {
var selection = e.currentTarget;
var questionId = e.currentTarget.className;
var currentQuestion = questions.find(function(q) {
return q.questionId == questionId;
});
if (currentQuestion.locked) {
alert("Question already answered");
} else if (currentQuestion.answer === e.currentTarget.firstElementChild.innerText) {
clearInterval(x);
//table.deleteRow(0);
//document.getElementById("timer").setAttribute('class', 'hidden_timer');
selection.firstElementChild.setAttribute('class', 'locked');
alert("Correct!!!");
currentQuestion.locked = true;
setTimeout(() => {
selection.setAttribute('class', 'correct');
}, 2000);
} else {
alert("Incorrect...");
clearInterval(x);
//table.deleteRow(0);
//document.getElementById("timer").setAttribute('class', 'hidden_timer');
selection.firstElementChild.setAttribute('class', 'locked');
currentQuestion.locked = true;
setTimeout(() => {
selection.firstElementChild.setAttribute('class', 'incorrect');
console.log(document.getElementById(currentQuestion.answerId + i));
document.getElementById(currentQuestion.answerId + i).setAttribute('class', 'correct');
}, 2000);
}
//generateQuestion(questions[i]);
}
function startTest() {
generateQuestion(questions[i]);
}
.correct {
display: flex;
align-items: center;
width: 90%;
height: auto;
min-height: 40px;
position: relative;
background: green;
color: white;
}
.correct::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid green;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.correct::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid green;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.lifeline {
background-color: pink;
color: white;
}
.incorrect {
display: flex;
align-items: center;
width: 90%;
height: auto;
min-height: 40px;
position: relative;
background: red;
color: white;
}
.incorrect::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid red;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.incorrect::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid red;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.locked {
display: flex;
align-items: center;
width: 90%;
height: auto;
min-height: 40px;
position: relative;
background: yellow;
color: white;
}
.locked::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid yellow;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.locked::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid yellow;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.timeout {
background-color: orange;
color: white;
}
.hidden_timer {
visibility: hidden;
display: none;
}
.visible {
visibility: visible !important
}
.timeout {
display: flex;
align-items: center;
width: 90%;
height: auto;
min-height: 40px;
position: relative;
background: orange;
color: white;
}
.timeout::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid orange;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.timeout::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid orange;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.question1 {
display: flex;
align-items: center;
height: auto;
min-height: 40px;
position: relative;
background: blue;
color: white;
}
.question1::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid blue;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.question1::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid blue;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.table_cstm {
border-collapse: separate;
border-spacing: 15;
/* Apply cell spacing */
table-layout: fixed
}
td:last-child div {
margin-left: auto;
}
/* Play header starts */
.button_cstm_quit {
background-color: red;
border: none;
color: white;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px;
margin: 4px 2px;
cursor: pointer;
border-radius: 50%;
}
.button_cstm_quit:hover {
color: red;
font-weight: bold;
background: none;
border: 2px solid red;
}
.button_cstm_ll {
background-color: blue;
border: none;
color: white;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px;
margin: 4px 2px;
cursor: pointer;
border-radius: 50%;
position: relative;
}
.button_cstm_ll:hover {
color: blue;
font-weight: bold;
background: none;
border: 2px solid blue;
}
.button_cst_pnts {
background-color: orange;
border: none;
color: white;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px;
margin: 4px 2px;
cursor: pointer;
border-radius: 50%;
position: relative;
}
.button_cst_pnt:hover {
color: orange;
font-weight: bold;
background: none;
border: 2px solid orange;
}
.button_cstm_nxt {
background-color: blue;
border: none;
color: white;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px;
margin: 4px 2px;
cursor: pointer;
border-radius: 50%;
position: relative;
}
.button_cstm_nxt:hover {
color: blue;
font-weight: bold;
background: none;
border: 2px solid blue;
}
.button_cstm_time {
background-color: #FF8C00;
border: none;
color: white;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px;
margin: 4px 2px;
cursor: pointer;
border-radius: 50%;
}
.button_cstm_time:hover {
color: #FF8C00;
font-weight: bold;
background: none;
border: 2px solid #FF8C00;
}
#container_cstm {
width: 100%;
}
#left_cstm {
float: left;
width: 100px;
}
#right_cstm {
float: right;
width: 100px;
}
#center_cstm {
margin: 0 auto;
width: 100px;
}
#play_head {
display: flex;
/* establish flex container */
flex-direction: row;
/* default value; can be omitted */
flex-wrap: nowrap;
/* default value; can be omitted */
justify-content: space-between;
/* switched from default (flex-start, see below) */
}
.red_cross:before,
.red_cross:after {
position: absolute;
content: '';
top: -5px;
bottom: -5px;
width: 5px;
background: #ff0000;
left: 0;
right: 0;
margin: 0 auto;
}
.red_cross:before {
transform: skew(30deg);
}
.red_cross:after {
transform: skew(-30deg);
}
.disp_none {
display: none;
}
/* Play header ends */
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
<body onload="startTest()">
<div class="container">
<table id="test" class="table table-responsive table_cstm" cellspacing="100">
</table>
</html>
关于javascript - 使用跨度,其他文本在下一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51054154/
我想要以下代码的 Python 单行解决方案,但是怎么做呢? total = 0 for ob in self.oblist: total += sum(v.amount for v in o
今天和大家一起学习一种可视化技术:构建树状热力图treemap。树形图易于可视化,且易于被人理解。树状图通过展示不同大小的矩形,以传达不同大小的数据量,一般认为,较大的矩形意味着占总体的一大部分,而较
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我有一个声明 $set eq "Y" ? $set = "N" : $set = "Y"; 但不管它总是设置为 "N" # Toggle setting if ($set eq "Y") { $
当我尝试在我的服务器上上传一个 php 文件时,我收到一条消息:"Parse error: ..." 我知道这是什么意思,但问题是别的。 如果我在本地服务器上编辑文件(我的计算机上安装了 XAMPP)
我是 python oneliner 循环的新手。 我希望用户将数据输入到二维列表中,同时提醒他他们将输入的数据索引。我的代码是: flag=0 x=[[int(input("enter the "+
尝试在变量之前和之后打印字符串。C 是否有能力使用一条语句来显示此输出? 这有效: float value = 5; printf("\nThe value of %f", value); print
我正在验证我创建的 MySQL 数据库的结果,为此,我需要一些屏幕截图。 例如,以下查询: select distinct run_ID from ngsRunStats_FK.failedRuns
有人可以解释一下这个 JS LINE 吗?数据是一个对象。 var list = data == null ? [] : (data.wine instanceof Array ? data.wine
如何在一行中添加三个下拉菜单。我想把我的日、月和年放在一行中,但不能这样做。任何帮助将不胜感激。我附上我的 jsfiddle . .... 最佳
我正在尝试使用 html 将 iframe 的高度设置为 100%(我已成功完成),但我还在顶部添加了一行额外的文本,所以它太高了 ~16px(这需要一个滚动条)。有没有办法更改 iframe 以显示
这是一个示例,我从文件中读取行作为字符串,以使整个文件作为字符串数组: String[] ArrayOfStrings = (new Scanner( new File("log.txt") ).us
我有一个包含大量定义的配置文件,用于在编译期间包含模块。此外,这意味着我必须经常检查代码内部的定义。每张支票需要 3 行,是否可以在一行中执行此操作。 #if FUNC_ENABLED functio
我正在尝试制作一个水平列表,其中每个 列表中的 s 的高度为 385px,宽度为 400px。 我尝试使用 inline-block 使列表水平排列,但这似乎不起作用。也就是说,我的意思是列表仍然是垂
这很烦人,我有一个带有 css 文件的 wordpress 主题,所有内容都在一长行中。我想知道为什么有人会那样做。现在我已经升级了,我需要将旧文件与新文件进行比较,以便我可以接受更改。 Meld、d
我有一个对象数组,其中每个对象都有一个 search_order 属性。我要检查数组并将所有对象的属性增加 1这是简单的方法: res = [] for r in array: r.searc
我在某些服务器上遇到许多具有相同内容和相同名称的文件。我需要隔离这些文件进行分析,所以我不能只删除重复项。操作系统为Linux(centos和ubuntu)。 我枚举文件名和位置并将它们放入文本文件中
你能在不抛出错误的情况下解决这个问题吗?答案是单线。这是来自一个死的职位发布,在回复中要求回答。我认为这是剔除受访者的聪明方法,但我似乎无法在不出错的情况下回答它。 显而易见的解决方案: f.moo(
这个问题在这里已经有了答案: Is it ok if I omit curly braces in Java? [closed] (16 个答案) 关闭 9 年前。 我在 java 中使用没有大括号
我在这里试图用 python 制作一个简单的计算器,我想知道是否可以在命令运行时将前 3 行合并为一行。我的意思是;我不必按 Enter 键来键入下一个数字/运算符,而是按空格键(在输入部分)。 wh
我是一名优秀的程序员,十分优秀!