帝国CMS+JAVASCRIPT内容页点击改变字号大小方法(通用前端)

2019-03-2610:55:35网站建设与开发Comments1,801 views字数 412阅读模式
Excerpt

 内容页浏览内容可改变字号大小的方法 

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

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

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

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

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

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

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

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

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

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

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

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

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

Comment

匿名网友 填写信息

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

确定