生成css并插入到hea
function addCSS(cssText) {
var style = document.createElement('style');
var head = document.head || document.getElementsByTagName('head')[0];
style.type = 'text/css';
if (style.styleSheet) {
// 兼容ie
var func = function() {
try {
style.styleSheet.cssText = cssText
} catch (e) {}
};
if (style.styleSheet.disabled) {
setTimeout(func, 10)
} else {
func()
}
} else {
var textNode = document.createTextNode(cssText);
style.appendChild(textNode)
};
head.appendChild(style)
};
addCSS("*{margin: 0;padding: 0;}")
生成html内容
document.write('<div>我是小霸王悠悠</div>')
在需要该内容的地方引入改js文件
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。