我在正确调整选择选项框以处理我想要的操作上遇到困难。
我是CSS / HTML的新手,目前正在做一个项目,该目标基本上是一个网站,用于复制考试/学生在线考试的内容。
屏幕快照中当前添加的框是从数据库发送给我的编程问题的完整长度。我正在基于过滤器的选项标签中填充不同的问题。
我唯一真正的问题是如何正确地“整体”查看问题而不是xxx像素的空间。(当前设置为600)。
选择标记是否仍可以通过显示多行来显示大量文本(一个很长的问题)?如果是的话,请帮助我理解如何,如果不是的话,那是我设置方式的另一种选择。
我需要能够选择它,因为我将选择的值(问题)添加到了同一页面上显示的“考试”中,然后将其与所选的任何问题一起提交。
当前相关代码:
<select class="questionBank" id="questionSelect" size="10" style="width:600px;"></select>
//some of the script code to maybe help understand whats happening.
//this script is just the filter connecting to a backend program and pulling correct questions for population.
<script>
function filterq(){
var ajaxRequest = new XMLHttpRequest();
ajaxRequest.onreadystatechange = function() {
if (this.readyState == 4) {
document.getElementById('questionSelect').innerText = null
alert(this.responseText);
for(i=0;i<21;i++){
var questionDisplay = document.getElementById("questionSelect");
var options = document.createElement("option");
var data=JSON.parse(this.responseText);
questionArray.push(data['list'][i]['question']);
idArray.push(data['list'][i]['ID']);
options.text=questionArray[i]+" (ID:"+idArray[i]+")";
questionDisplay.add(options); …Run Code Online (Sandbox Code Playgroud)