帝国CMS内容页点击改变字号大小的方法(javascript代码)

2018-02-0105:25:19网站建设与开发Comments2,507 views字数 439阅读模式

内容页浏览内容可改变字号大小的方法 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

以前有人发过这样的方法,我这里也来发一个。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

1.在内容模板的头部里加入下面的代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

<script type="text/javascript">文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

function FontZoom(fsize){文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

var ctext = document.getElementById("contents");文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

ctext.style.fontSize = fsize +"px";文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

}文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

</script>文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

2.把你想要改变字体大小的内容部分加上id名。如: <div id="contents">[!--newstext--]</div>文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

3.在你想要放控制按钮的地方放入下面的代码:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

字体:【<a href='javascript:FontZoom(16)'>大</a> <a href='javascript:FontZoom(14)'>中</a> <a href='javascript:FontZoom(12)'>小</a>】文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

16,14,12就是字号的大小,可以修改为你想要的数字。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/211.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/cms/211.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定