整理:常用的網頁特殊效果JS代碼

來源:互聯網
上載者:User
收藏本站
<span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.webjx.com','網頁教學網')" title="網頁教學網">收藏本站</span>
或:
<Script Language="JavaScript">
  function bookmarkit()
  {
  window.external.addFavorite('http://你的網址','你的網站名稱')
  }
  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.webjx.com');" style="CURSOR: hand">設為首頁</span>

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

在原視窗中開啟onclick="location.href='http://www.webjx.com;" style="cursor:pointer;"

在新視窗中開啟onclick="location.href='http://www.webjx.com';" style="cursor:pointer;"

前進<INPUT name=Submit onclick=history.go(1) type=submit value=前進>

後退<INPUT name=Submit2 onclick=history.go(-1) type=submit value=後退>

關閉當前視窗<a href="/"onClick="javascript:window.close();return false;">關閉視窗</a>

列印<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=列印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>

高亮顯示的行onMouseOut="this.bgColor='';this.style.color='#000'" onMouseOver="this.bgColor='highlight';this.style.color='#fff'"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.