在jQuery测验中插入图像

时间:2017-10-27 11:23:56

标签: javascript jquery

我在网上下载了一个jQuery测验,我能够编辑它,但问题不包括图像,我希望我的测验有图像问题。答案选项不需要图像。

我以为我可以在问题JavaScript文件中添加内联,这是一个单独的文件,但它显然没有用。

有人可以指点我如何在问题中加入图片吗?

谢谢

/*--------------------------------------
Questions JS
------------------------------*/

$("#quiz1").dlxQuiz( { 
    quizData: {
        "questions": [{ 
            "q": "When following a large vehicle you should keep well back because this (mark ONE answer)",
            "a": "Allows the driver to see you in the mirrors",

            "options": [
                "Allows you to corner more quickly",
                "Helps the large vehicle to stop more easily",
                "Allows the driver to see you in the mirrors",
                "Helps you to keep out of the wind"
            ]



        },

{ "images": ["../images/image1.png"],
            "q": "You are waiting to come out of a side road. Why should you watch carefully for motorcycles? (Mark one answer.)",
            "a": "Motorcycles are small and hard to see",
            "options": [
                "Motorcycles are usually faster than cars",
                "Police patrols often use motorcycles",
                "Motorcycles are small and hard to see",
                "Motorcycles have right of way"
            ]
        }, ]
    }
});

1 个答案:

答案 0 :(得分:0)

我把它整理出来了。实际上解决方案非常简单。我只需要在问题的开头添加图像标记。即。

    "q": "<img src=\"img1.png\"/><br>When following a large vehicle you should keep well back because this (mark ONE answer)",