2 回答
TA贡献2065条经验 获得超13个赞
您可以使用反引号 (`),这将允许您在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>
添加回答
举报