0
我有一個簡單的JS測驗在頁面上生成問題結果的答案並將它們放入html中。在幾個答案中,id喜歡說'更多信息點擊這裏'。如何添加一個鏈接到被放入html中的JS字符串?如何將鏈接添加到JS驅動的測驗答案中?
林很新的JS所以真的不知道如何去這個...
這是獲取調用的JS:
{ // Question
"q": "<h4>Is it recommended to use one vial of BOTOX<sup>®</sup> on more than one patient?</h4>",
"a": [
{"option": "TRUE", "correct": false},
{"option": "FALSE", "correct": true}
],
"correct": "<p><span>CORRECT!</span> As the diluents in BOTOX<sup>®</sup> do not contain a preservative it is not recommended to use on more than one patient.2 If you would like to refer to this information again, it can be found via the link below.</p>",
"incorrect": "<p><span>INCORRECT.</span> As the diluents in BOTOX<sup>®</sup> do not contain a preservative it is not recommended to use on more than one patient.<sup>2</sup> If you would like to refer to this information again, it can be found via the link below.</p><p>***here is where I would like the link to be***</p>"
},
如何將其添加到腳本中?然後,如何在html字符串中調用var? – DaveP19
你可以在你現有的代碼塊中添加它(無論你想要哪個網址)。我不確定你想要用現有的Javascript做什麼。您能否請您發佈更多代碼,以便我瞭解如何操縱HTML。 –
哦,我的意思是我該如何編寫代碼來添加鏈接... 所以在上面的js代碼中我有這個 -
***這裏是我想要的鏈接***
- 那是我需要寫鏈接的地方。那麼如何在該空間中調用鏈接變量? – DaveP19