2 回答

TA貢獻(xiàn)2065條經(jīng)驗(yàn) 獲得超14個(gè)贊
您可以使用反引號(hào) (`),這將允許您在txt
. 例如:gettip(`This 'string' can include "quotes"`)
對(duì)于您的情況:
onmouseover="gettip(`<img src='Images/homeworkpreview.jpg'><br><br><b>Due:</b> January 27 <br> <b>Points:</b> 50 <br> <br> <b> Description: </b> <br> Create a Homework page with a table with information about the projects for this semester. This will act as the hub for all of your projects to be linked to.`)"
注意:這適用于約 95% 的用戶。如果您需要更多報(bào)道,您可以按照此處的其他答案指示轉(zhuǎn)義引號(hào)。

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊
轉(zhuǎn)義單引號(hào)后,您需要一些帶有 id 的元素info,例如:
function gettip(txt) {
document.getElementById("info").innerHTML = txt;
}
function reset() {
document.getElementById("info").innerHTML =
"Roll over a link for information on the project! ";
}
<a href="Homework.html" onmouseover="gettip('<img src=\'Images/homeworkpreview.jpg\'><br><br><b>Due:</b> January 27 <br> <b>Points:</b> 50 <br> <br> <b> Description: </b> <br> Create a Homework page with a table with information about the projects for this semester. This will act as the hub for all of your projects to be linked to.')"
onmouseout="reset()">
Homework
</a>
<div id="info"></div>
添加回答
舉報(bào)