Giter Site home page Giter Site logo

js's Introduction

JS笔记


3.7

查css 鼠标划过显示

alert 是弹出提示框

给网页一个new DATE() 是不是可以得到时间?

3.8

数组的方法 length push pop unshift shift splice concat链接
splice(a,b,c,d) 索引a的位置开始删除b个元素,添加元素,c,d.. join(‘’) 方法设置分隔符并讲其转换为字符串

字符串 split() 可以将其转换为数组

window.prompt(a,b) a是提示,b是默认值

3.9

  1. 获取样式 和属性 obj.style[样式] 只能获取行内样式 obj.getCurrentStyle['width']; 只能用于ie getComputedStyle(obj,false)['width']; 可以用于所有浏览器 if(obj.getCurr...){var width = obj.getCurr....} else{var width = getCom....}

  2. arguments 获取函数参数 arguments.length 获取传入方法的参数个数 或者 直接在声明函数时给予 形参

4个内置函数:parseInt,parseFloat,isNaN,eval 对象的属性:prototype 给一类对象添加方法和属性。 var bill = new employee(...); employee.prototype.salary = null; vill.salary = 2000;

  1. offsetleft 元素距离左侧的位置

  2. setInterval(function(),time) clearInterval(funtions) 停止functions定时器

  3. var e = e || window.event; 获取鼠标或者键盘

  4. clientX 获取鼠标位置

  5. offsetleft 控件距离左侧距离

#2017年 03月 16日 星期四 09:11:22 CST

  1. onselect
  2. oncopy nocopy window.event.returnValue=false
  3. oncut onpaste no cut or onpaste
  4. oncontextmenu right key fobit list
  5. addEventListener('event',function) event needn't on
  6. removeEventListener('',fun..)
  7. confirm(); a tip for del in a.oclick
  8. location
    • href
    • hash
    • host
    • pathname
  9. history
    • go(-1) -1 is back 1 is go window.history.go

#2017年 03月 17日 星期五 10:24:31 CST

  1. input.onfocus 获取焦点 input.onblur 失去焦点

#2017年 03月 20日 星期一 09:37:46 CST

  1. document.write('') write to html

写js的位置,1.onclick中内嵌。2.onclick调用js方法。3.js中获取点击事件。

  1. s1.innerHTML document.write() #String ##属性 lengh ##方法 indexOf(string,[int]) lastIndexOf() charAt(int) 同string[int] 一样 toLowerCase() 字符串转化为小写 toUpperCase() slice() 返回字符串片段 substring() 截取 字符串 substr() 截取从指定位置开始,指定长度 #Math .abs() .min() .max() .random() .round() .floor() .ceil() #Date new Date() 有参为参数时间。 无参为当前 ##get 对象 getDate() 月份中的天数 getDay() 星期几0-6 getHours() 0-23 getMinutes() 0-59 getSeconds() 0-59 getMonth() 0-11 getYear() 年份 getTime() 1970-1-1 到现在的毫秒 getFullYrear() == getYear()+1900 ##set 对象 setDate() 设置月份中天数 setHours() setMinutes() setSeconds() setTime() setMonth() 1-12 没写都是0开始 #定时器 setTimeout() setInterval() #event event = e|| window.event keyCode clientX clientY #window对象 ##方法 confirm(); alert() prompt(); print(); setTimeout(); setInterval(); open(); close(); ##属性 closed查看是否已经关闭 #location ##属性 href hash host pathname search ##方法 reload() assign(); replace(); #history history.back() history.forward() hsitory.go() #DOM ##属性 document.title ##获取元素方法: document.getElementById() document.getElementByTagName() document.getElementByName(); #document 对象 ##属性 getAttribute() setAttribute() ##内容 innerHTML innerText||textContent; ##元素创建 document.createElement(); document.createTextNode(); ##节点操作 appendChild(); insertBefore(); removeChild(); cloneNode(); replaceChild(); ##节点获取 parentNode children and childNodes firstChild and firstElementChild lastChild and lastElementChild nextSibling and nextElementSibling previousSibling and previousElementSibling #form document.forms可以访问 ##基础 method GET/POST action URL enctype 编码

js's People

Contributors

glittering avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.