聚合乐下载:热门综合高速软件下载
安卓游戏
热门搜索: 工具 生活 游戏 效率
您当前所在位置:首页 > 资讯教程 > 网页设计

网页字体大小调整_网页字体颜色修改

时间:2026-02-18 10:00:55 标签: 网页设计 字体调整 cookie控制 网页字体颜色 字体大小
类型:社交
大小:173.5MB
版本:

1、


减小字体
增大字体


大小

2、


用onclick事件实现改变文章字体大小



大字体 |
中字体 |
小字体

点击上面的“大字体”,“中字体”,“小字体”,可以相应改变字体大小。


3、

改变字体大小

[大字体
中字体
小字体]

4、加入cookie控制

function setCookie(name, value) /cookies设置
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
if(expires!=null){
var LargeExpDate = new Date ();
LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24));
}
document.cookie = name + = + escape (value) + ; path=/; +((expires == null) ? : ( expires= +LargeExpDate.toGMTString()));
}

function getCookie(Name) /cookies读取
{
var search = Name + =;
if(document.cookie.length > 0){
offset = document.cookie.indexOf(search);
if(offset != -1) {
offset += search.length;
end = document.cookie.indexOf(;, offset);
if(end == -1){
end = document.cookie.length;
}
return unescape(document.cookie.substring(offset, end));
}
}
return ;
}

/ 内容样式用户定义
function ContentSize(size)
{
var obj=document.getElementById(content);
obj.style.fontSize=size>0 ? size+px : ;
if (arguments.length==1){
setCookie(iwmsFontSize,size,size==0?-1:1);
}
}
function ContentBg(color)
{
var obj=document.getElementById(bodyTd);
obj.style.backgroundColor=color;
if (arguments.length==1){
setCookie(iwmsContBg,color,color.length==0?-1:1);
}
}
function InitContStyle()
{
var v=getCookie(iwmsFontSize);
if (v.length>0){
ContentSize(v,false);
}
v=getCookie(iwmsContBg);
if (v.length>0){
ContentBg(v,false);
}
}


/***

精品推荐