if (document.documentElement.clientWidth > 600) {//页面宽度大于600px让其宽度等于600px,字体大小等于60px,居中 document.documentElement.style.width = "600px"; document.documentElement.style.fontSize = "60px"; document.documentElement.style.margin = "…
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir=&qu…
通过下面的代码判断分辨率 <script language="JavaScript"> <!-- Begin function redirectPage() { var wjbxue=screen.width; var hjbxue=screen.height; alert("经系统检测,你的屏幕分辨率为 " + wjbxue+"*"+ hjbxue + "by 脚本学堂 jbxue.com"); } //…
  Javascript: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.body.offsetWidth (包括边线的宽)网页可见区域高: document.body.offsetHeight (包括边线的高)网页正文全文宽: document.body.scrollWidth网页正文全文高: document.body.scrollHeight网页被卷去的高: do…
<script> $('#questSort').change(function(){ //此处写状态改变要实现的功能 var s=$('#questSort').children('option:selected').val(); if(s==1){ //ar d=document.getElementById('q'); //d.style.display="none"; }else{ //var d=document.getElementById('q'); //d.…
目前,有了css3的rem,给我们的移动端开发带来了前所未有的改变,使得我们的开发更容易,更易兼容很多设备,但这个不在本文讨论的重点中,本文重点说说如何使用js来实时改变网页文字的大小. 代码: <script> /* 长宽占位 rem算法, 根据root的rem来计算各元素相对rem, 默认html 320/20 = 16px */ function placeholderPic(){ var w = document.documentElement.offsetWidth; documen…
//检测文件大小和类型 function fileChange(target){ //检测上传文件的类型 if(!(/(?:jpg|gif|png|jpeg)$/i.test(target.value))) { alert("只允许上传jpg|gif|png|jpeg格式的图片"); if(window.ActiveXObject) {//for IE target.select();//select the file ,and clear selection document.sel…
//设置页面文字大小 function SetFontSize(areaid, size) { document.getElementById(areaid).style.fontSize = size + "px"; } 字号[<a href="javascript:SetFontSize('txtcontent','18')">大</a> <a href="javascript:SetFontSize('txtconten…
有这样一个需求,要求在一个列表中的每个条目中展示字数不限个数的文本.而且每个条目的宽度都是固定的,展示的文本如果过长,不可以用省略号显示,只能动态的调整(缩小)文本的字号来达到文本能完全显示的效果,而且要限一行展示.关于这个效果,其实目前android官方已经提供了实现方式.那就是AutoSizeableTextView. <android.support.v7.widget.AppCompatTextView android:id="@+id/atv" android:layo…
原因 从4.0开始,系统设置中“显示”可以对字体大小进行配置,这会影响到TextView等控件中文字显示的大小. 解决方案 在自定义的Activity中重写getResources方法 @Override public Resources getResources() { Resources res = super.getResources(); Configuration conf = new Configuration(); conf.setToDefaults(); res.updateC…