jquery实现字体选择

<head runat="server">

<script src="/static/js/jquery-1.2.6.js" type="text/javascript"></script>

<style type="text/css">

.tl_common {}

.tl_blue { color:#0000ff;}

.tl_red {color:#ff0000;}

.tl_boldblue {color:#0000ff;font-weight:bolder;}

.tl_boldred {color:#ff0000;font-weight:bolder;}

</style>

<body>

<select >预览资讯标题样式</span>]

</body>

<script type="text/javascript">

$(function() {

initcolorpicker($("#titlestyle"), '资讯标题资讯标题');

});

function initcolorpicker(selectinst,title) {

var colorarr = { 'tl_common': '普通', 'tl_blue': '蓝色', 'tl_red': '红色', 'tl_boldblue': '蓝色粗体' , 'tl_boldred': '红色粗体'};

$.each(colorarr, function(i, val) {

var color = i.toString();

var option = document.createElement("option");

option.value = color;

var textnode = document.createTextNode(decodeURIComponent(val));

option.appendChild(textnode);

selectinst.append(option);//这个函数是对,titlestyle赋值

});

return selectinst;

}

</script>

只是为了方便记忆!