博客字体增大缩小模块,请点击本页右上角测试效果.
<script type="text/javascript">
/* = 请先定义下列参数 = */
var _name = "div";
var _attr = "id";
var _post = "content";
/* =================== */
function isdigit(c)
{
return ((c>='0') && (c<='9'));
}
function atoi(s)
{
var t=0;
for(var i=0; i < s.length; i++)
{
var c=s.charAt(i);
if(!isdigit(c))
return t;
else
t = t*10 + (c-'0');
}
return t;
}
function fontZoom(size)
{
var element = document.getElementsByTagName(_name);
for(var i=0; i < element.length; i++)
{
if(element[i].getAttribute(_attr) == _post)
{
if (element[i].style.fontSize == '')
element[i].style.fontSize = "14px";
var fixsize = atoi(element[i].style.fontSize) + size;
if (fixsize <= 0)
fixsize = 14;
element[i].style.lineHeight = "1.2";
element[i].style.fontSize = fixsize + "px";
}
}
}
</script>
Font Size: <a href="javascript:fontZoom(+1)" title="Zoom In"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAePC6WVlCBUZaR21_f69VWY5AQRn7FkUZ1KM7DgEhEHtYB_xFE61R0UXujtToOSOCK5YFIvH2f4g6Ozy_7_q46vffJxWdo5CBmCvttP8gSSAmIc7rdEMWH0WIAZuXJK7mBTzhrwJmGNw/" /></a> <a href="javascript:fontZoom(-1)" title="Zoom Out"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPqgoySr_M8VaRY2eaqd7NfAVN_MargELrWxWRVZmuqvQFTrzWJ5C8Zxd0udRrxniOXCWWradB33bXmqu1BdCdA8aTYnob3N1uPnCIrFucVvOPRtvAKrTpCxr_KTKvHJMwsAjmCxj51UY/" /></a>
No comments :
Post a Comment