惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
G
Google Developers Blog
L
LangChain Blog
腾讯CDC
大猫的无限游戏
大猫的无限游戏
U
Unit 42
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
The GitHub Blog
The GitHub Blog
博客园_首页
GbyAI
GbyAI

博客园 - -only-

FlyakiteOSX安装帮助 ubuntu安装ibus输入法 超链接样式 远程桌面登陆工具下载 Linux Yum命令(转) FLV播放器 源码二例(转) 利用FLV组件制作播放器 vsftp配置文件属性 linux下mysql远程登陆 - -only- - 博客园 在Linux下安装和使用MySQL MyEclipse注册码收集 在Flash中调用xml文档 使用FLVPlayback组件播放fms(fcs)的流式FLV文件 .Net中url传递中文的解决方案 计算器 java中的 equal 和 == 的区别 Javascript函数大全 struts标签库 Hibernate中DetachedCriteria的使用(转)
网页设计常用的Javascript特效代码
-only- · 2007-12-20 · via 博客园 - -only-

实用的JS代码片段——网页特效代码很多了,这里收集整理的是一些常规的比较实用的JS代码片断。

  字号缩放

  让文字大点,让更多的用户看的更清楚。(也可以把字体变为百分比来实现)

<script type="text/JavaScript"> 
function doZoom(size) 
{document.getElementById('zoom').style.fontSize=size+'px';} 
</script> 
<span id="zoom">需要指定大小的文字</span> 
< a href="javascript:doZoom(16)">大</a> <a href="javascript: doZoom(14)">中</a> <a href="javascript:doZoom(12)">小< /a>

  跳转菜单新窗口

<select name="select" onchange="window.open(this.options[this.selectedIndex].value)"> 
<option value="http://www.microsoft.com/ie"> Internet Explorer</option> 
<option value="http://www.microsoft.com"> Microsoft Home</option> 
<option value="http://msdn.microsoft.com"> Developer Network</option> 
</select>

  添加到收藏夹和设为首页

  添加到收藏夹

<a href="javascript:window.external.addFavorite('http://链接','说明');">添加到收藏夹</a>

  设为首页

<a href=# onclick=this.style.behavior='url(#default#homepage)';this.setHomePage ('http://链接');>设为首页</a>

  打开窗口即最大化

<script language="JavaScript">  
<!-- Begin  
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)  
// End -->  
</script>

  加入背景音乐

<bgsound src="mid/windblue[1].mid" loop="-1"> 只适用于IE 
<embed src="music.mid" autostart="true" loop="true" hidden="true">

对Netscape ,IE 都适用

  防止点击空链接时,页面往往重置到页首端

  代码“javascript:void(null)”代替原来的“#”标记,也可以用“#nogo”来代替啊?

  自动换行

 style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word"

  只对IE有用...FF的话用overflow:hidden来解决,不至于影响美观