How to add individual customized content in typecho?
I thought for a long time about adding script and jquery when it was first loaded...
First show a demo
Implementation method
Common properties of iframe
name : Provisions <iframe> The name of the. width : Provisions <iframe> The width of. height : Provisions <iframe> The height of. src : Specified in <iframe> The URL of the document displayed in. frameborder : Specify whether to display <iframe> The surrounding border. (0 is no border, and 1 bit has a border). align : Specify how to align according to surrounding elements <iframe> 。 (left, right,top,middle,bottom)。 scrolling : Specify whether the <iframe> Scroll bars are displayed in. (yes,no,auto)
Get the contents of iframe
var iframe = document.getElementById("myframe"); // Get iframe tag Var iwindow=iframe. contentWindow;//Get the window object of iframe Var idoc=iwindow.document;//Get the document object of iframe console.log(idoc.documentElement); // Get the html of iframe console.log("body",idoc.body);
Get Dom element in iframe
var ifr = document.getElementById("myframe2"); var dom= ifr.contentWindow.document.getElementById("textid")
var par1 = window.parent.document.getElementById("div")//vanilla js var par2 = window.parent.$("div")//jquery