导航:首页 > 编程语言 > 飘落的字体js代码

飘落的字体js代码

发布时间:2023-06-03 19:18:03

❶ 雪花飘落的js代码

N是管雪花的数抄量,Y是雪袭花下落的速度,(document.layers)?window.innerHeight:window.document.body.clientHeight;是雪花下落的尺寸,可以改为=(document.layers)?window.innerHeight+100:window.document.body.clientHeight;+100,下落尺寸加大100。

❷ js实现动态改变字体大小代码

在很多大网站上为了提高用户方便阅读文字,都提供有字体大小选择功能,以适应不同年龄段人群的阅读需求,其实这种功能实现起来也很简单,修改起来也方便,字体大号由你来定,默认字体大小可以CSS页面中定义,一般网页的标准字体是9pt,也就是12px;
实例代码一:
<!DOCTYPE
html>
<html>
<head>
<title>修改字体大小.html</title>
<meta
http-equiv="keywords"
content="keyword1,keyword2,keyword3">
<meta
http-equiv="description"
content="this
is
my
page">
<meta
http-equiv="content-type"
content="text/html;
charset=UTF-8">
<!--<link
rel="stylesheet"
type="text/css"
href="./styles.css">-->
<style
type="text/css">
div{
border:1px
red
solid;
width:455px;
font-size:16px;
}
.max{
font-size:20px;
}
.moren{
font-size:16px;
}
.min{
font-size:12px;
}
</style>
<script
type="text/javascript">
//此种方式降低了js和CSS的耦合性
function
changeFontSize(fontStyle){
//
获取节点对象
var
divNode
=
document.getElementsByTagName("div")[0];
//
设置该节点的Name属性以及属性值
divNode.className=fontSize;
}
/*
function
changeFontSize2(fontSize){
//
获取节点对象
var
divNode
=
document.getElementsByTagName("div")[0];
divNode.style.fontSize=fontSize;
}
*/
</script>
</head>
<body>
<a
href="javascript:void(0)"
onclick="changeFontSize2('20px')"
class="max">大号</a>
<a
href="javascript:void(0)"
onclick="changeFontSize2('16px')"
class="moren">中号</a>
<a
href="javascript:void(0)"
onclick="changeFontSize2('12px')"
class="min">小号</a>
<div>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
这里呢就是显示的文字,通过点击上面的超链接改变此字体大小<br/>
</div>
</body>
</html>
实例方法二:
<html>
<head>
<title>JavaScript设置网页字体</title>
<style>
body{
font-size:9pt;
}
</style>
</head>
<body>
<div
id=zoom>这是一段示例文字,你可以点击下边选择不同字号的字体,这段文字会随即改变大小。脚本之家。</div>
<SCRIPT
language=JavaScript>
function
doZoom(size){
document.getElementById('zoom').style.fontSize=size+'pt'
}
</SCRIPT>
<P
align=right>选择字号:[
<A
href="javascript:doZoom(13)">13pt(超大)</A>
<A
href="javascript:doZoom(10.5)">10.5pt(中型)</A>
<A
href="javascript:doZoom(9)">9pt(标准)</A>
]
</body>
</html>

❸ 求段网页右下角漂浮的JS代码,放广告用的!

<!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">
<head>
<title>不会被屏蔽的网页右下角漂浮窗口代码</title>
<FCK:meta http-equiv="content-type" content="text/html;charset=gb2312" />
<style type="text/css">
#msg_win{border:1px solid #A67901;background:#EAEAEA;width:300px;position:absolute;right:0;font-size:12px;font-family:Arial;margin:0px;display:none;overflow:hidden;z-index:99;}
#msg_win .icos{position:absolute;top:2px;*top:0px;right:2px;z-index:9;}
.icos a{float:left;color:#833B02;margin:1px;text-align:center;font-weight:bold;width:14px;height:22px;line-height:22px;padding:1px;text-decoration:none;font-family:webdings;}
.icos a:hover{color:#fff;}
#msg_title{background:#FECD00;border-bottom:1px solid #A67901;border-top:1px solid #FFF;border-left:1px solid #FFF;color:#000;height:25px;line-height:25px;text-indent:5px;}
#msg_content{margin:0px;width:300px;height:300px;overflow:hidden;}
</style>
</head>
<body>
<p style="height:1000px;"></p>
<div id="msg_win" style="display:block;top:490px;visibility:visible;opacity:1;">
<div class="icos"><a id="msg_min" title="最小化" href="javascript:void 0" _fcksaverl="javascript:void 0">_</a><a id="msg_close" title="关闭" href="javascript:void 0" _fcksaverl="javascript:void 0">×</a></div>
<div id="msg_title">标题</div>
<div id="msg_content">
<img src="http://www.chinesesavvy.com/export/sites/default/images/stories/images/Subject/2007newyear/chunjie_texttu03.gif" width="300" height="300" border="0"/>
</div>
</div>
<script language="javascript">
var Message={
set: function() {//最小化与恢复状态切换
var set=this.minbtn.status == 1?[0,1,'block',this.char[0],'最小化']:[1,0,'none',this.char[1],'恢复'];
this.minbtn.status=set[0];
this.win.style.borderBottomWidth=set[1];
this.content.style.display =set[2];
this.minbtn.innerHTML =set[3]
this.minbtn.title = set[4];
this.win.style.top = this.getY().top;
},
close: function() {//关闭
this.win.style.display = 'none';
window.onscroll = null;
},
setOpacity: function(x) {//设置透明度
var v = x >= 100 ? '': 'Alpha(opacity=' + x + ')';
this.win.style.visibility = x<=0?'hidden':'visible';//IE有绝对或相对定位内容不随父透明度变化的bug
this.win.style.filter = v;
this.win.style.opacity = x / 100;
},
show: function() {//渐显
clearInterval(this.timer2);
var me = this,fx = this.fx(0, 100, 0.1),t = 0;
this.timer2 = setInterval(function() {
t = fx();
me.setOpacity(t[0]);
if (t[1] == 0) {clearInterval(me.timer2) }
},10);
},
fx: function(a, b, c) {//缓冲计算
var cMath = Math[(a - b) > 0 ? "floor": "ceil"],c = c || 0.1;
return function() {return [a += cMath((b - a) * c), a - b]}
},
getY: function() {//计算移动坐标
var d = document,b = document.body, e = document.documentElement;
var s = Math.max(b.scrollTop, e.scrollTop);
var h = /BackCompat/i.test(document.compatMode)?b.clientHeight:e.clientHeight;
var h2 = this.win.offsetHeight;
return {foot: s + h + h2 + 2+'px',top: s + h - h2 - 2+'px'}
},
moveTo: function(y) {//移动动画
clearInterval(this.timer);
var me = this,a = parseInt(this.win.style.top)||0;
var fx = this.fx(a, parseInt(y));
var t = 0 ;
this.timer = setInterval(function() {
t = fx();
me.win.style.top = t[0]+'px';
if (t[1] == 0) {
clearInterval(me.timer);
me.bind();
}
},10);
},
bind:function (){//绑定窗口滚动条与大小变化事件
var me=this,st,rt;
window.onscroll = function() {
clearTimeout(st);
clearTimeout(me.timer2);
me.setOpacity(0);
st = setTimeout(function() {
me.win.style.top = me.getY().top;
me.show();
},600);
};
window.onresize = function (){
clearTimeout(rt);
rt = setTimeout(function() {me.win.style.top = me.getY().top},100);
}
},
init: function() {//创建HTML
function $(id) {return document.getElementById(id)};
this.win=$('msg_win');
var set={minbtn: 'msg_min',closebtn: 'msg_close',title: 'msg_title',content: 'msg_content'};
for (var Id in set) {this[Id] = $(set[Id])};
var me = this;
this.minbtn.onclick = function() {me.set();this.blur()};
this.closebtn.onclick = function() {me.close()};
this.char=navigator.userAgent.toLowerCase().indexOf('firefox')+1?['_','::','×']:['0','2','r'];//FF不支持webdings字体
this.minbtn.innerHTML=this.char[0];
this.closebtn.innerHTML=this.char[2];
setTimeout(function() {//初始化最先位置
me.win.style.display = 'block';
me.win.style.top = me.getY().foot;
me.moveTo(me.getY().top);
},0);
return this;
}
};
Message.init();
</script>
</body>
</html>

❹ 用js设置html标签的字体大小

使用jquery设置font标签样式 http://hemin.cn/jq/css.html
取得第一个段落的color样式属性的值。
jQuery 代码:
$("p").css("color");

(这是一个示例 按照这个匹配标签就行了)注意需要导入 jquery的 js文件

❺ js设置字体颜色

js改变字体的颜色是用的“color”属性,xmlHttp.open("GET",URL,true)是设置ajax的请求地址和请求方式,不能去掉。

1、新建html文档,在body标签中添加p标签,标签内容是“演示文本”,这时字体的默认颜色是黑色的:

❻ 求一个js让图片飘落效果

代码结构如下

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<script type="text/javascript" src="./js/EffectItem.js"></script>
<script type="text/javascript" src="./js/Effect.js"></script>
<script type="text/javascript">
new Effect({
effectUrl : './images/timg.jpg',
rotate : false,
direction : "up"
});
</script>
</body>
</html>

效果如下:



代码太多,放不完,你私信我,我发你

❼ 用CSS或js如何实现字体渐渐消失

无论css还是js,都有好多种方法能实现,写个简单的例子给你

jquery写法(需要加载jquery文件),如下:专

<h1class="demo">测试文字属,测试文字,测试文字</h1>
$(".demo").hover(function(){
$(this).fadeOut(1000);
});

css写法,如下:

<h1class="demo">测试文字,测试文字,测试文字</h1>
.demo{
transition:1s;
-moz-transition:1s;
-webkit-transition:1s;
-o-transition:1s;
}
.demo:hover{
opacity:0;
}
阅读全文

与飘落的字体js代码相关的资料

热点内容
彩视制作教程 浏览:766
圣墟在哪个App看免费 浏览:395
网络哪些不能玩 浏览:868
probe315使用教程 浏览:646
数字电位器程序 浏览:198
c代码整理 浏览:104
网络营销具有什么优势 浏览:378
右下角网络连接不显示宽带连接 浏览:940
ps修改tif文件 浏览:580
预防医学如何转行做大数据 浏览:234
pdf文件变蓝 浏览:309
怎么在pdf文件上面用k宝签名 浏览:213
如何知道表格里数据后面有空格 浏览:720
gee引擎更新系统找不到指定文件 浏览:802
贝壳网的数据删除了如何找回 浏览:509
华为荣耀6x怎么切换网络 浏览:418
手机里的pdf文件在哪放 浏览:889
java版贪吃蛇毕业论文 浏览:989
微信公共号邮箱 浏览:415
图片宽度代码 浏览:460

友情链接