首页 > 编程知识 正文

将html文件转换成字符串(javascript和css)

时间:2023-05-06 06:34:32 阅读:72176 作者:3241

它从textarea获取输入并创建变量代码。 根据需要转义反斜杠和引号。

功能标记可变

var code=document.getelementbyid (' input ' ).value.trim )、

output=document.getelementbyid (output );

output.text content=' varmyvariable=' ' kx dsw/pcode.replace (/g,(\" ) )。

. replace(/)/g,) )轻松的芒果/p.replace )/([nr]/g,(n ) ) kxdsw/p ); ';

}

document.queryselector(button ) ).addeventlistener )、makeVariable );

功能标记可变

var code=document.getelementbyid (' input ' ).value.trim )、

output=document.getelementbyid (output );

output.text content=' varmyvariable=' ' kx dsw/pcode.replace (/g,(\" ) )。

. replace(/)/g,) )轻松的芒果/p.replace )/([nr]/g,(n ) ) kxdsw/p ); ';

}

textarea {

高海拔: 20em;

width: 100%;

}

pre {

white-space :预失真;

后台: # 246;

color:白色;

padding: 0.2em;

}

创建可变

pagetitlethisisaheadingthisisaparagraph。

This has a backslash (。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。