日期:2014-05-16 浏览次数:20398 次
<div id="font_detail" style="position:absolute;visibility:hidden;" onclick="choose_font(event,'show_type')">
<div style="font-family:微软雅黑;"><a href="#">微软雅黑</a></div>
<div style="font-family:宋体;"><a href="#">宋体</a></div>
<div style="font-family:楷体;"><a href="#">楷体</a></div>
<div style="font-family:黑体;"><a href="#">黑体</a></div>
<div style="font-family:隶书;"><a href="#">隶书</a></div>
<div style="font-family:andale mono;"><a href="#">andale mono</a></div>
<div style="font-family:arial;"><a href="#">arial</a></div>
<div style="font-family:arial black;"><a href="#">arial black</a></div>
<div style="font-family:comic sans ms;"><a href="#">comic sans ms</a></div>
</div>
function choose_font(browser,id)
{
var tmp
var element
var newNode
element=browser.srcElement||browser.target
tmp=document.getElementById(id)
if(element.tagName.toLowerCase()=='a')
{
font_type=element.parentNode.style.fontFamily
newNode=document.createTextNode(element.parentNode.style.fontFamily)
tmp.replaceChild(newNode,tmp.firstChild)
}
}