魔方新手入门_新手入门常用代码集锦

时间:2014-10-01  来源:常用代码  阅读:

本贴主要是收集各种比较入门的代码

层的隐藏与显示

  只要设置style的display属性即可
  比如隐藏的层
  如果要显示它可以通过脚本来控制
  window.document.getElementById("MyDiv").style.display = "";

禁止右键
  
  

屏蔽页面中程序运行出错信息

  window.onerror = function()
  {
    return true;
  }

得到当前显示器的分辨率

  window.srceen.width 得到屏幕的宽度
  window.srceen.height 得到屏幕的高度
  如果当前分辨率为800*600,window.srceen.width是800,window.srceen.height是600

定时运行特定代码

  setTimeout(Code,Timeout);
  setInterval(Code,Timeout);
  Code是一段字符串,里边是js代码,Timeout是时间间隔,单位是微秒
  setTimeout是从现在算起多少微秒后运行该代码(只运行一次)
  setInterval是每隔多少微秒运行一次代码

得到本页网址

  var Url = window.location.href;

保存当前页面的内容

  document.execCommand("SaveAs","","C:\\index.htm");

魔方新手入门_新手入门常用代码集锦

http://m.bbyears.com/css/9673.html

推荐访问:长板教学新手入门 象棋怎么玩新手入门
相关阅读 猜你喜欢
本类排行 本类最新