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>
asked Nov 6, 2013 at 1:15
Willis Zawisa
1291 gold badge6 silver badges14 bronze badges
1 Answer 1
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>'
);
Sign up to request clarification or add additional context in comments.
Comments
default
"<a href=\"Home Page.html\" .... </a>"document.writeto create html content. Instead look at creating a new node and setting the html content of that instead