javascript - Changing a font-family in an same-domain IFrame -
i have iframe referencing file on same domain, no issues. through javascript, can change font-size, color, everything. except font-family. weird. let me change properties, family, need!
function changefont() { var x = document.getelementbyid("image"); var y = x.contentdocument; y.body.style.fontsize = "20px"; y.body.style.color = "red"; y.body.style.fontfamily = "algerian"; } <iframe onload="changefont()" id="image" width="100%" height="400" src="@url.content("~/content/temp.txt")"></iframe>
to change font-family
property have because of hyphen.
function changefont() { var x = document.getelementbyid("image"); var y = x.contentdocument; y.body.style.fontsize = "20px"; y.body.style.color = "red"; y.body.style["font-family"] = "algerian"; }
Comments
Post a Comment