当前位置: 首页 > 图文教程 > 网络编程 > 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   浏览: 311 ::
收藏到网摘: n/a

收藏本站

以下为引用的内容:
<span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.ruanchen.com','软晨学习网')" title="软晨学习网">收藏本站</span>

或:

以下为引用的内容:
<script Language="JavaScript">
  function bookmarkit()
  {
  window.external.addFavorite('http://www.ruanchen.com','软晨学习网')
  }
  if (document.all)document.write('<a href="#" onClick="bookmarkit()">加入收藏夹</a>')
  </script>

通用的加入收藏夹

以下为引用的内容:
<script type="text/javascript">
// <![CDATA[
function bookmark(){
var title=document.title
var url=document.location.href
if (window.sidebar) window.sidebar.addPanel(title, url,"");
else if( window.opera && window.print ){
var mbm = document.createElement('a');
mbm.setAttribute('rel','sidebar');
mbm.setAttribute('href',url);
mbm.setAttribute('title',title);
mbm.click();}
else if( document.all ) window.external.AddFavorite( url, title);
}
// ]]>
</script>  
<a href="javascript:bookmark()">加入收藏夹</a>

在IE6-7. FF2.0 OP9.0中测试通过

设为首页

以下为引用的内容:
<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.ruanchen.com');" style="CURSOR: hand">设为首页</span>

返回页首

以下为引用的内容:

<img src="/imgs/top.gif" onClick="javascript:document.location='#top'" style="cursor:pointer;">