2 回答

TA貢獻2065條經驗 獲得超14個贊
您可以使用反引號 (`),這將允許您在txt
. 例如:gettip(`This 'string' can include "quotes"`)
對于您的情況:
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% 的用戶。如果您需要更多報道,您可以按照此處的其他答案指示轉義引號。

TA貢獻1836條經驗 獲得超3個贊
轉義單引號后,您需要一些帶有 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>
添加回答
舉報