首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
canclebubble还是stoppropatation
2024-08-28
cancelbubble和stoppraopagation区别
事实上stoppropagation和cancelBubble的作用是一样的,都是用来阻止浏览器默认的事件冒泡行为. 不同之处在于stoppropagation属于W3C标准,试用于Firefox等浏览器,但是不支持IE浏览器.相反cancelBubble不符合W3C标准,而且只支持IE浏览器.所以很多时候,我们都要结合起来用.不过,cancelBubble在新版本chrome,opera浏览器中已经支持.
【干货分享】前端面试知识点锦集03(JavaScript篇)——附答案
三.JavaScript部分 1.谈谈你对Ajax的理解?(概念.特点.作用) AJAX全称为“Asynchronous JavaScript And XML”(异步JavaScript和XML) 是指一种创建交互式网页应用的开发技术.改善用户体验,实现无刷新效果. 优点a.不需要插件支持b.优秀的用户体验c.提高Web程序的性能d.减轻服务器和带宽的负担缺点a.浏览器对XMLHttpRequest对象的支持度不足,几乎所有浏览器现在都支持b.破坏浏览器“前进”.“后退”按钮的正常功能,可以通过
转载请注明出处: https://github.com/qiu-deqing/FE-interview
转载请注明出处: https://github.com/qiu-deqing/FE-interview Table of Contents generated with DocToc FE-interview $HTML, HTTP,web综合问题 常见排序算法的时间复杂度,空间复杂度 前端需要注意哪些SEO web开发中会话跟踪的方法有哪些 <img>的title和alt有什么区别 doctype是什么,举例常见doctype及特点 HTML全局属性(global attribute)有哪些
浏览器兼容性-JS篇
总结一下平时遇到的浏览器兼容性问题,本篇关于JS. 1.事件绑定 兼容写法: function add(obj,event){ if (obj.addEventListener) { obj.addEventListener(event,fn,fase); }else{ obj.attachEvent("on"+event,fn); } } 小结:addEventListener()兼容firefox.chrome.safari.opera.IE9+ attachEvent()兼容IE
javascript中BOM部分基础知识总结
一.什么是BOM BOM(Browser Object Document)即浏览器对象模型. BOM提供了独立于内容 而与浏览器窗口进行交互的对象: 由于BOM主要用于管理窗口与窗口之间的通讯,因此其核心对象是window: BOM由一系列相关的对象构成,并且每个对象都提供了很多方法与属性: BOM缺乏标准,JavaScript语法的标准化组织是ECMA,DOM的标准化组织是W3C,BOM最初是Netscape浏览器标准的一部分. 二.学习B
【经验之谈】前端面试知识点总结03(JavaScript相关)——附答案
目录 三.JavaScript部分 1.谈谈你对Ajax的理解?(概念.特点.作用) 2.说说你对延迟对象deferred的理解? 3.什么是跨域,如何实现跨域访问? 4.为什么要使用模板引擎? 5.JavaScript是一门什么样的语言,它有哪些特点? 6.JavaScript的数据类型有哪些? 7.已知ID的Input输入框,如何获取这个输入框的输入值?(不使用第三方框架) 8.根据你的理解,请简述JavaScript脚本的执行原理? 9.DOM操作怎样添加.移除.移动.复制.创建和查找节点
javascript应用之如何判断一个数为素数
判断是否为素数? 质数(prime number)又称素数,有无限个.质数定义为在大于1的自然数中,除了1和它本身以外不再有其他因数的数称为质数. 合数,数学用语,英文名为Composite number,指自然数中除了能被1和本身整除外,还能被其他数(0除外)整除的数.与之相对的是质数(因数只有1和它本身,如2,3,5,7,11,13等等,也称素数),而1既不属于质数也不属于合数.最小的合数是4. <!DOCTYPE html> <html lang="en">
浅谈JavaScript中的事件
引言 Html页面与JavaScript之间的交互是通过事件来完成的.事件,就是文档或者浏览器窗口中发生的一些特定的交互瞬间.可以使用侦听器(处理程序)来预订事件,以便事件发生时执行相应的代码.这在传统的软件工程中称为观察者模式. 事件流 事件流描述的是从页面中接收事件的顺序.但是IE团队和Netscape团队提出了完全相反的事件流概念.IE提出的是事件冒泡流,Netscape提出的是事件捕获流.下面我们就来详细介绍这方面的内容. 事件冒泡 IE的事件流是事件冒泡.即事件开始时由最具体的元素(文
JS中的事件冒泡(Bubble)和事件捕获(capture)以及如何阻止事件的冒泡
对“捕获”和“冒泡”这两个概念,通常我们对冒泡了解和使用的会更多一些,因为在我们使用的所有浏览器中,都支持事件冒泡 ,即事件由子元素向祖先元素传播的,就 像气泡从水底向水面上浮一样.而在像firefox,chrome,safari这类所谓的标准浏览器中,事件传播通常是有三个阶段的:事件捕获阶段,事 件目标阶段,事件冒泡阶段,这三者的执行的顺序是先捕获在冒泡.对于捕获阶段,这个很少 有用武之地,所以被人疏忽遗忘也在所难免了,不常用不代表它不存在,本着科学严谨的态度,我们有必要去看一下它的庐山真面目
web面试题大全
$HTML, HTTP,web综合问题 常见排序算法的时间复杂度,空间复杂度 前端需要注意哪些SEO web开发中会话跟踪的方法有哪些 <img>的title和alt有什么区别 doctype是什么,举例常见doctype及特点 HTML全局属性(global attribute)有哪些 什么是web语义化,有什么好处 HTTP method 从浏览器地址栏输入url到显示页面的步骤(以HTTP为例) HTTP request报文结构是怎样的 HTTP response报文结构是怎样的 如何进
Event事件跨浏览器封装
var Event = { //注册事件 addEvent: function(element,type,handler){ if(element.addEventListener){ //DOM2级 element.addEventListener(type,handler,false); //false为冒泡,true为捕获 }else if(element.attachEvent){ //IE element.attachEvent("on"+type,function(){ /
JS事件分析
1.注册事件 1.1 使用HTML元素的事件属性 <div id='myDiv' style="width:100px;height:100px;background-color:red" onclick="clickHandler()" onmouseover="javascript:mouseOverHandler()"> </div> 1.2 给元素对象添加事件属性---DOM0形式 <div id='myDi
JS通用事件监听函数
JS通用事件监听函数 版本一 //把它全部封装到一个对象中 var obj={ readyEvent:function (fn){ if(fn==null){ fn=document; } var oldOnload=window.onload; if(typeof window.onload !='function'){ window.onload=fn; }else{ window.onload=function (){ oldOnload(); fn(); } } },//添加事假 add
javascript知识点记录(1)
javascript一些知识点记录 1.substring,slice,substr的用法 substring 和slice 都有startIndex 和 endIndex(不包括endInex),区别就在于slice取负数; 例如:var str='x123'; slice(-1,-2) -1指的就是3 负-2指的就是2: substring的中的负数,当做零来处理 substring中可以颠倒startIndex 和 endIndex的顺序,它会自动将最小的识别为开始的索引,最大的为结束索引
《JS高程》事件学习笔记
事件:文档或浏览器窗口中发生的一些特定的交互瞬间,也即用户或浏览器自身执行的某种动作. ----------------------------------------------------------------------------------------------------------- 一.事件流 事件流:描述的是页面中接收事件的顺序. IE:事件冒泡流,即事件开始时由最具体的元素接收,然后逐级向上传播到较为不具体的节点(文档): NetScape:事件捕获流,即
JavaScript--DOM事件(笔记)
第1章 事件流1-1.事件冒泡:事件最开始由最具体的元素(文档中嵌套层次最深的那个节点)接收; 然后逐级向上传播至最不具体的那个节点(文档);1-2.事件捕获:不太具体的节点应该更早接收到事件,而最具体的节点最后接收到事件; 第2章 事件处理程序 2-1 HTML事件处理程序 //缺点:HTML和JS代码紧密的耦合在一起; 1 <input type="button" value="按钮" onclick="showMessage()"&g
js跨浏览器事件对象、事件处理程序
项目中有时候会不用jquery这么好用的框架,需要自己封装一些事件对象和事件处理程序,像封装AJAX那样:这里面考虑最多的还是浏览器的兼容问题,原生js封装如下:var EventUtil={ //节点.事件名.事件处理函数 addHanler:function(element,type,handler){ if(element.addEventListener){ element.addEventListener(type,handler,false);//这里一个参数为false意为在事件冒
关于考虑浏览器兼容性时间的工具demo
//支持跨浏览器的添加事件. var btn = document.getElementById("btn"); function showMes() { alert("hello world!"); } var eventUtil = { addHander:function(element,type,hander) { //判断是否是除IE以外的DOM2级操作 if (element.addEventListener) { element.addEventLis
简单总结焦点事件、Event事件对象、冒泡事件
每学习一些新的东西,要学会复习,总结和记录. 今天来简单总结一下学到的几个事件:焦点事件.Event事件对象.冒泡事件 其实这几个事件应该往深的说是挺难的,但今天主要是以一个小菜的角度去尝试理解一些基本的知识点. 1.焦点事件: 1.1概念理解: 想象场景:当一堆text文本框出现在面前,当点击其中一个文本框,它就会响应用户,并出现光标闪动(这时,点击令它获得焦点). 所以说:焦点事件是用来让浏览器区分哪一个对象是用户要进行操作(输入值.选择.跳转)的. 总结===> 浏览器(区分)哪一个对象
JavaScript 客户端JavaScript之事件(DOM API 提供模块之一)
具有交互性的JavaScript程序使用的是事件驱动的程序设计模型. 目前使用的有3种完全不同的不兼容的事件处理模型. 1.原始事件模型 (一种简单的事件处理模式) 一般把它看作0级DOM API的一部分内容,所有启用了JavaScript的浏览器都支持它,因此它具有可移植性. 2.标准事件模型 (一种强大的具有完整性的事件模型) 2级DOM标准对它进行了标准化,除IE以外的所有浏览器都支持它. 3.IE事件模型 想用高级事件处理特性的JavaScript程序设计者必须为IE浏览
前端知识点-JS相关知识点
1.谈谈你对Ajax的理解?(概念.特点.作用) AJAX全称为"Asynchronous JavaScript And XML"(异步JavaScript和XML) 是指一种创建交互式网页应用的开发技术.改善用户体验,实现无刷新效果. 优点 a.不需要插件支持 b.优秀的用户体验 c.提高Web程序的性能 d.减轻服务器和带宽的负担 缺点 a.浏览器对XMLHttpRequest对象的支持度不足,几乎所有浏览器现在都支持 b.破坏浏览器"前进"."后退&
热门专题
如何让linux下的tomcat静态资源https
target 启动iser
对于文件,属性i表示
softmax求梯度及代码
mac达芬奇 无法保存文件
maxcomputer sql格式
django中background
C语言求图的最短路径(迪杰斯特拉算法实现)
python自动生成xml自动标注
subs_filter 全局替换
对 osd lost,然后osd又起来会怎么样
idea插件没有lua
echart点击旋转
java map 筛选值数量大于一
LightGBM算法
.net framework 4.5 使用log4net
Ubuntu编译vpp python 报错
idea拉取合并提交
苹果公司开发者账号申请
git 查找某个文件提交记录