自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 资源 (1)
  • 收藏
  • 关注

原创 为dom元素添加事件时,函数里的this指向问题

1.如下方式为dom元素添加事件时,check里的this指向window对象,因为默认是window调用的,谁调用this就指向谁<input type="submit" value="提交" name="sub" onclick="return check()"2..如下方式为dom元素添加事件时,check里的this指向相对应的dom元素document.myform[0].sub....

2018-06-21 00:13:52 2026

原创 setTimeout执行

用setTimeout设置一个延时器,这里用注意的时,程序在执行的时候不会停在这个语句那里,而是会继续执行,我在做一个表单时候发现一个问题myform[0].sub.disabled = true;return true;大概意思就是:点击提交表单按钮后,就使按钮失效,可以防止在网速不好的时候防止多次提交,然后返回true,确认点击,使得表单提交,但是实际效果表单却提交不了,这可能是因为,使的提...

2018-06-18 10:47:00 574

原创 form表单检验的两种事件

1.在from里添加submit事件<form action="test2.html" method="post" onsubmit = "return checkDate()"> <p>用户名:<input type="text" name="id"></p> <p&

2018-06-17 10:37:31 1398

原创 Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())", "...

2018-06-15 20:05:09 234

原创 if里定义函数预编译问题

if(function b(){}){    b();}上面语句会报错,因为在执行完if括号里的语句后,b函数就别回收了,下面的b就是未定义的,使用就会报错console.log(text);//undefinedif(function b(){}){    function text(){    }}console.log(text);//text函数因为在if大括号里定义函数,...

2018-06-13 23:32:45 1028 1

原创 js里判断变量是数组还是对象的四种方法

var obj = { }var arr = [];//用constructor判断,arr和obj本身没有constructor属性,但它的原型上有console.log(arr.constructor === Array) console.log(obj.constructor === Array);...

2018-06-13 21:50:11 16541

原创 浏览器对html页面的解析过程

从上到下运行,先解析head标签中的代码,(1)head标签中会包含一些引用外部文件的代码,从开始运行就会下载这些被引用的外部文件         当遇到script标签的时候         浏览器暂停解析(不是暂停下载),将控制权交给JavaScript引擎(解释器)         如果<script>标签引用了外部脚本,就下载该脚本,否则就直接执行,执行完毕后将控制权交给浏览器...

2018-06-13 19:22:23 4471

原创 17. Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given...

2018-06-12 20:29:58 145 1

原创 十秒后才能注册的小demo

js部分function down(){ if(but[0].getAttribute('value') == '注册'){ but[0].setAttribute('value', '10'); but[0].style.backgroundColor = '#aeacac'; } else if(but[0].getAttribute('value') == ...

2018-06-12 13:47:49 196

原创 15. 3Sum

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contain ...

2018-06-11 10:41:01 123

原创 848. Shifting Letters

We have a string S of lowercase letters, and an integer array shifts.Call the shift of a letter, the next letter in the alphabet, (wrapping around so that 'z' becomes 'a'). For example, shift('a') = '...

2018-06-10 11:04:08 267

原创 14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Input: ["flower","flow","flight"]Output: "fl"E...

2018-06-08 21:07:53 107

原创 13. Roman to Integer

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...

2018-06-08 20:32:01 155

原创 function里的this指向问题

有时候我会把事件函数里的this当成出发该事件的dom对象,其实不是这样的除非用call和aply去改变this指向,否则this是指向window的例如下面代码:<form action="#"> 邮编:<input type="text" name = "" onkeyup = "checkDate(this.value)"> </form&

2018-06-08 09:12:27 2238

原创 12. Integer to Roman

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...

2018-06-08 00:09:55 121

原创 数组对象的forEach函数

大家都知道这个函数会遍历数组里'所有'元素,依次调用回调函数,并将数组元素的值和下标作为回调函数的参数,但我们要注意的是这里的所有只包括元素的序号为数字的元素,如果数组里下标不是数字的元素是不会被遍历的比如下列代码:arr = [1,2]; arr[2] = 'jay'; arr[name] = 'jay'; arr[10] = 'zhou'; arr['5'] = 'jie';...

2018-06-07 16:31:21 619

原创 11. Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two ...

2018-06-06 20:24:53 133

原创 二进制反码的计算

0和0相加是0,0和1相加是1,1和1相加是0但要产生一个进位1,加到下一列。如果最高位相加后产生进位,则最后得到的结果要加1。1.反码运算时,其符号位与数值一起参加运算。2.反码的符号位相加后,如果有进位出现,则要把它送回到最低位去相加(循环进位)。3.用反码运算,其运算结果亦为反码。在转换为真值时,若符号位为0,数位不变;若符号位为1,应将结果求反才是其真值。(这里求反不包括符号位)[例1] ...

2018-06-05 21:26:35 14147 3

原创 9. Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation: F...

2018-06-05 19:52:01 87

原创 javaScript里的string的match函数返回值的问题

当没有使用全局匹配时,返回的数组中有input和index属性当没有使用全局匹配时,返回的数组中有input和index属性

2018-06-05 08:12:24 2426

原创 8. String to Integer (atoi)

Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this ...

2018-06-04 20:52:22 139

原创 JSP课设遇到的问题总结

1.在做公告功能模块的时候,用到了定时器,在改变元素left的时候用的是style.left方法来改变它的left值,本来想用的是setAttribute()方法,但后来想了一下不行,因为这个方法是为dom元素添加属性的,但left谈不上是dom元素的属性,只能说是dom元素style属性的一个样式2.获取dom元素的高度用window.getComputedStyle(dom元素)方法3.一个s...

2018-06-03 19:37:19 1486

JavaScript权威指南(上)

JavaScript学习宝典,有名的犀牛书,包含详细的js语法

2019-02-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除