简体   繁体   中英

Put HTML code inside document.write

I want to put this HTML inside document.write. How would I do that because the quotes get messed up when I try to.

<a href="Home Page.html"
onMouseOver="document.thereg1.src=red1.src"
onMouseOut="document.thereg1.src=reg1.src">
<img src="1.gif" Name="thereg1"></a>

As the comment says you shouldn't really use document.write but if you have to you can do:

document.write(
'<a href="Home Page.html"' +
'onMouseOver="document.thereg1.src=red1.src"' +
'onMouseOut="document.thereg1.src=reg1.src">' +
'<img src="1.gif" Name="thereg1"></a>'
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM