当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 网页设计常用的Javascript特效代码

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

网页设计常用的Javascript特效代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 305 ::
收藏到网摘: n/a

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

  字号缩放

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

<script type="text/javascript"> 
function doZoom(size) 
{document.getElementById('zoom').style.fontSize=size+'px';} 
</script> 
<span id="zoom">需要指定大小的文字</span>  软晨学习网http://www.ruanchen.com
<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)    软晨学习网http://www.ruanchen.com
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来解决,不至于影响美观