我试图让它显示图像(或其他对象),然后提示然后左行图像(或其他对象)全部放在一行(一行)中。为什么要在自己的行上显示每个图像?
var to_add = "<div>";
// add the left stimulus
if (trial.west_is_html) {
to_add+="<img id='jspsych-single-stim-stimulus-west' src="+trial.a_path_west.src +" height="+trial.a_path_west.height+" width="+trial.a_path_west.width+" style=display:'inline-block'>";
}
else {
to_add+="<div id='jspsych-single-stim-stimulus-west'>"+trial.a_path_west+"</div>";
}
//show prompt if there is one
if (trial.prompt !== "") {
to_add+="<div style=disaply'inline-block'>" + trial.prompt+ " </div>";
}
// show the right stimulus
if (trial.east_is_html) {
to_add+="<img id='jspsych-single-stim-stimulus-east' src="+trial.a_path_east.src +" height="+trial.a_path_east.height+" width="+trial.a_path_east.width+" style=display:'inline-block'>";
}
else {
to_add+="<div id='jspsych-single-stim-stimulus-east'>"+trial.a_path_east+"</div>";
}
to_add+="</div>"
display_element.append(to_add);
谢谢!
最佳答案
你有错别字:
style=display:'inline-block'
应该在所有地方:
style='display:inline-block'