jquery js字体放大缩小

<script type="text/javascript">
$(function(){
$("span").click(function(){
var thisEle = $("#para div span,#para_title,#para_time").css("font-size");
var textFontSize = parseFloat(thisEle , 10);
var unit = thisEle.slice(-2); //获取单位
var cName = $(this).attr("class");
if(cName == "bigger"){
if( textFontSize <= 22 ){
textFontSize += 2;
}
}else if(cName == "smaller"){
if( textFontSize >= 12 ){
textFontSize -= 2;
}
}
$("#para div span,#para_title,#para_time").css("font-size", textFontSize + unit);
});
});
</script>

 

<script type="text/javascript">
function doZoom(size) {
var zoom = document.all ? document.all['Zoom'] : document.getElementById("Zoom").children();
zoom.style.fontSize = size + 'px';
}
</script>

 

contents() 只能获取子节点的内容,而不能获取子孙节点的内容

posted @ 2013-05-23 12:45  不再犹豫、  阅读(748)  评论(0编辑  收藏  举报