模板:Codepen:修订间差异
来自康健生活
无编辑摘要 |
无编辑摘要 |
||
| 第10行: | 第10行: | ||
|{{#tag:html| | |{{#tag:html| | ||
{{#tag:html|{{#tag:script|function {{{id|}}}(_){ | {{#tag:html|{{#tag:script|function {{{id|}}}(_){ | ||
const target = _.contentDocument | const target = _.contentDocument <nowiki>||</nowiki> _.contentWindow.document; | ||
target.body.innerHTML = `{{#if:{{{style|}}}|{{#tag:style|{{{style|}}}|type=text | target.body.innerHTML = `{{#if:{{{style|}}}|{{#tag:style|{{{style|}}}|type=text<nowiki>/</nowiki>css}}|}}{{#if:{{{html|}}}|{{{html|}}}|}}` | ||
if ({{{script|}}}) { | if ({{{script|}}}) { | ||
const ele = document.createElement('script'); | const ele = document.createElement('script'); | ||
ele.type = 'text/javascript'; | ele.type = 'text<nowiki>/</nowiki>javascript'; | ||
ele.innerHTML = {{{script|}}}; | ele.innerHTML = {{{script|}}}; | ||
target.body.appendChild(ele) | target.body.appendChild(ele) | ||