当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 网页制作中常用的几段小Javascript代码

Javascript
[IE&FireFox兼容]JS对select操作
JS实现全景图效果360度旋转
Unicode 编码转换器
如何用javascript判断录入的日期是否合法
图片从右至左滚动JS
JS控件autocomplete 0.11演示及下载 1月5日已更新
一个对于js this关键字的问题
Javascript标准DOM Range操作全集
兼容Mozilla必须知道的知识。
你所要知道JS(DHTML)中的一些技巧
JS效率个人经验谈(8-15更新),加入range技巧
如何让动态插入的javascript脚本代码跑起来。
Javascript调试工具(下载)
脚本中出现 window.open() access is denied - 拒绝访问 情况一则及分析
Javascript-Mozilla和IE中的一个函数直接量的问题
贴一个在Mozilla中常用的Javascript代码
Javascript miscellanea -display data real time, using window.status
js技巧--转义符"\"的妙用
In Javascript Class, how to call the prototype method.(three method)
Javascript与vbscript数据共享

网页制作中常用的几段小Javascript代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 171 ::
收藏到网摘: 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;">