JavaScript , js 上下文(this 的指代)
上下文 代表 this 变量的值, 以及 它的 指代;
它决定一个函数怎么被调用;
当一个函数作为一个对象的方法被调用的时候, this总是指向 调用这个方法的对象.
-----
1 ,情况一: 字面量对象中的this
var pet = {
words: '...',
speak: function(){
console.log(this.words);
console.log(this === pet);
}
} pet.speak();
pet对象调用 speak方法, this 指向 pet对象; 因此 this.words 等于 '...';
this === pet ,正确.
2.情况二: 普通函数中的 this
//2: 普通函数中的this function pet(words)
{
this.words = words; console.log(this.words);
console.log(this === global);
} pet('test,test');
可见,在 作为普通函数使用的时候, this 是 指代 最顶级的全局变量的, 在 浏览器中是 window对象 ; 在node中 是 global.
---------------------------------------------------------------
输出 global对象.
//2: 普通函数中的this function pet(words)
{
this.words = words; console.log(this.words);
console.log(this === global);
console.log(global);
} pet('test,test');
D:\node>node context.js
test,test
true
{ DTRACE_NET_SERVER_CONNECTION: [Function],
DTRACE_NET_STREAM_END: [Function],
DTRACE_HTTP_SERVER_REQUEST: [Function],
DTRACE_HTTP_SERVER_RESPONSE: [Function],
DTRACE_HTTP_CLIENT_REQUEST: [Function],
DTRACE_HTTP_CLIENT_RESPONSE: [Function],
COUNTER_NET_SERVER_CONNECTION: [Function],
COUNTER_NET_SERVER_CONNECTION_CLOSE: [Function],
COUNTER_HTTP_SERVER_REQUEST: [Function],
COUNTER_HTTP_SERVER_RESPONSE: [Function],
COUNTER_HTTP_CLIENT_REQUEST: [Function],
COUNTER_HTTP_CLIENT_RESPONSE: [Function],
global: [Circular],
process:
process {
title: 'C:\\WINDOWS\\system32\\cmd.exe - node context.js',
version: 'v4.5.0',
moduleLoadList:
[ 'Binding contextify',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule internal/util',
'Binding util',
'NativeModule timers',
'Binding timer_wrap',
'NativeModule _linklist',
'NativeModule assert',
'NativeModule util',
'Binding uv',
'NativeModule path',
'NativeModule module',
'NativeModule internal/module',
'NativeModule vm',
'NativeModule fs',
'Binding fs',
'NativeModule constants',
'Binding constants',
'NativeModule stream',
'NativeModule _stream_readable',
'NativeModule _stream_writable',
'NativeModule _stream_duplex',
'NativeModule _stream_transform',
'NativeModule _stream_passthrough',
'Binding fs_event_wrap',
'NativeModule console',
'Binding tty_wrap',
'NativeModule tty',
'NativeModule net',
'NativeModule internal/net',
'Binding cares_wrap',
'Binding tcp_wrap',
'Binding pipe_wrap',
'Binding stream_wrap',
'Binding signal_wrap' ],
versions:
{ http_parser: '2.7.0',
node: '4.5.0',
v8: '4.5.103.37',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '46',
openssl: '1.0.2h' },
arch: 'x64',
platform: 'win32',
release:
{ name: 'node',
lts: 'Argon',
sourceUrl: 'https://nodejs.org/download/release/v4.5.0/node-v4.5.0.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v4.5.0/node-v4.5.0-headers.tar.gz',
libUrl: 'https://nodejs.org/download/release/v4.5.0/win-x64/node.lib' },
argv:
[ 'D:\\Program Files\\nodejs\\node.exe',
'D:\\node\\context.js' ],
execArgv: [],
env:
{ ALLUSERSPROFILE: 'C:\\ProgramData',
APPDATA: 'C:\\Users\\dc5yy\\AppData\\Roaming',
CommonProgramFiles: 'C:\\Program Files\\Common Files',
'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
CommonProgramW6432: 'C:\\Program Files\\Common Files',
COMPUTERNAME: 'DESKTOP-2I328NT',
ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe',
configsetroot: 'C:\\WINDOWS\\ConfigSetRoot',
FPS_BROWSER_APP_PROFILE_STRING: 'Internet Explorer',
FPS_BROWSER_USER_PROFILE_STRING: 'Default',
HOMEDRIVE: 'C:',
HOMEPATH: '\\Users\\dc5yy',
LOCALAPPDATA: 'C:\\Users\\dc5yy\\AppData\\Local',
LOGONSERVER: '\\\\DESKTOP-2I328NT',
MOZ_PLUGIN_PATH: 'C:\\Program Files (x86)\\Foxit Software\\Foxit Reader\\plugins\\',
NUMBER_OF_PROCESSORS: '4',
OneDrive: 'C:\\Users\\dc5yy\\OneDrive',
OS: 'Windows_NT',
Path: 'C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;D:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files (x86)\\VisualSVN Server\\bin;D:\\Program Files\\nodejs\\;C:\\Users\\dc5yy\\AppData\\Roaming\\npm;C:\\Users\\dc5yy\\AppData\\Local\\Microsoft\\WindowsApps;D:\\xampp\\apache\\bin',
PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
PROCESSOR_ARCHITECTURE: 'AMD64',
PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',
PROCESSOR_LEVEL: '6',
PROCESSOR_REVISION: '3c03',
ProgramData: 'C:\\ProgramData',
ProgramFiles: 'C:\\Program Files',
'ProgramFiles(x86)': 'C:\\Program Files (x86)',
ProgramW6432: 'C:\\Program Files',
PROMPT: '$P$G',
PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules',
PUBLIC: 'C:\\Users\\Public',
SESSIONNAME: 'Console',
SystemDrive: 'C:',
SystemRoot: 'C:\\WINDOWS',
TEMP: 'C:\\Users\\dc5yy\\AppData\\Local\\Temp',
TMP: 'C:\\Users\\dc5yy\\AppData\\Local\\Temp',
USERDOMAIN: 'DESKTOP-2I328NT',
USERDOMAIN_ROAMINGPROFILE: 'DESKTOP-2I328NT',
USERNAME: 'admin',
USERPROFILE: 'C:\\Users\\dc5yy',
VISUALSVN_SERVER: 'C:\\Program Files (x86)\\VisualSVN Server\\',
windir: 'C:\\WINDOWS' },
pid: 7292,
features:
{ debug: false,
uv: true,
ipv6: true,
tls_npn: true,
tls_sni: true,
tls_ocsp: true,
tls: true },
_needImmediateCallback: false,
execPath: 'D:\\Program Files\\nodejs\\node.exe',
debugPort: 5858,
_startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
_stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
reallyExit: [Function: reallyExit],
abort: [Function: abort],
chdir: [Function: chdir],
cwd: [Function: cwd],
umask: [Function: umask],
_kill: [Function: _kill],
_debugProcess: [Function: _debugProcess],
_debugPause: [Function: _debugPause],
_debugEnd: [Function: _debugEnd],
hrtime: [Function: hrtime],
dlopen: [Function: dlopen],
uptime: [Function: uptime],
memoryUsage: [Function: memoryUsage],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_setupDomainUse: [Function: _setupDomainUse],
_events:
{ newListener: [Function],
removeListener: [Function],
SIGWINCH: [Object] },
_rawDebug: [Function],
_eventsCount: 3,
domain: null,
_maxListeners: undefined,
EventEmitter:
{ [Function: EventEmitter]
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function] },
_fatalException: [Function],
_exiting: false,
assert: [Function],
config: { target_defaults: [Object], variables: [Object] },
nextTick: [Function: nextTick],
_tickCallback: [Function: _tickCallback],
_tickDomainCallback: [Function: _tickDomainCallback],
stdout: [Getter],
stderr: [Getter],
stdin: [Getter],
openStdin: [Function],
exit: [Function],
kill: [Function],
mainModule:
Module {
id: '.',
exports: {},
parent: null,
filename: 'D:\\node\\context.js',
loaded: false,
children: [],
paths: [Object] } },
GLOBAL: [Circular],
root: [Circular],
Buffer:
{ [Function: Buffer]
poolSize: 8192,
from: [Function],
alloc: [Function],
allocUnsafe: [Function],
allocUnsafeSlow: [Function],
isBuffer: [Function: isBuffer],
compare: [Function: compare],
isEncoding: [Function],
concat: [Function],
byteLength: [Function: byteLength] },
clearImmediate: [Function],
clearInterval: [Function],
clearTimeout: [Function],
setImmediate: [Function],
setInterval: [Function],
setTimeout: [Function],
console: [Getter],
words: 'test,test' }
看 215行, global对象中存在一个属性: words ; 这是因为我们执行了赋值操作 this.words = words.
--------------------------------------------------------------
如果不执行 this.words = words;
//2: 普通函数中的this function pet(words)
{
// this.words = words; console.log(this.words);
console.log(this === global);
console.log(global);
} pet('test,test');
输出结果:
D:\node>node context.js
undefined
true
{ DTRACE_NET_SERVER_CONNECTION: [Function],
DTRACE_NET_STREAM_END: [Function],
DTRACE_HTTP_SERVER_REQUEST: [Function],
DTRACE_HTTP_SERVER_RESPONSE: [Function],
DTRACE_HTTP_CLIENT_REQUEST: [Function],
DTRACE_HTTP_CLIENT_RESPONSE: [Function],
COUNTER_NET_SERVER_CONNECTION: [Function],
COUNTER_NET_SERVER_CONNECTION_CLOSE: [Function],
COUNTER_HTTP_SERVER_REQUEST: [Function],
COUNTER_HTTP_SERVER_RESPONSE: [Function],
COUNTER_HTTP_CLIENT_REQUEST: [Function],
COUNTER_HTTP_CLIENT_RESPONSE: [Function],
global: [Circular],
process:
process {
title: 'C:\\WINDOWS\\system32\\cmd.exe - node context.js',
version: 'v4.5.0',
moduleLoadList:
[ 'Binding contextify',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule internal/util',
'Binding util',
'NativeModule timers',
'Binding timer_wrap',
'NativeModule _linklist',
'NativeModule assert',
'NativeModule util',
'Binding uv',
'NativeModule path',
'NativeModule module',
'NativeModule internal/module',
'NativeModule vm',
'NativeModule fs',
'Binding fs',
'NativeModule constants',
'Binding constants',
'NativeModule stream',
'NativeModule _stream_readable',
'NativeModule _stream_writable',
'NativeModule _stream_duplex',
'NativeModule _stream_transform',
'NativeModule _stream_passthrough',
'Binding fs_event_wrap',
'NativeModule console',
'Binding tty_wrap',
'NativeModule tty',
'NativeModule net',
'NativeModule internal/net',
'Binding cares_wrap',
'Binding tcp_wrap',
'Binding pipe_wrap',
'Binding stream_wrap',
'Binding signal_wrap' ],
versions:
{ http_parser: '2.7.0',
node: '4.5.0',
v8: '4.5.103.37',
uv: '1.9.1',
zlib: '1.2.8',
ares: '1.10.1-DEV',
icu: '56.1',
modules: '46',
openssl: '1.0.2h' },
arch: 'x64',
platform: 'win32',
release:
{ name: 'node',
lts: 'Argon',
sourceUrl: 'https://nodejs.org/download/release/v4.5.0/node-v4.5.0.tar.gz',
headersUrl: 'https://nodejs.org/download/release/v4.5.0/node-v4.5.0-headers.tar.gz',
libUrl: 'https://nodejs.org/download/release/v4.5.0/win-x64/node.lib' },
argv:
[ 'D:\\Program Files\\nodejs\\node.exe',
'D:\\node\\context.js' ],
execArgv: [],
env:
{ ALLUSERSPROFILE: 'C:\\ProgramData',
APPDATA: 'C:\\Users\\dc5yy\\AppData\\Roaming',
CommonProgramFiles: 'C:\\Program Files\\Common Files',
'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
CommonProgramW6432: 'C:\\Program Files\\Common Files',
COMPUTERNAME: 'DESKTOP-2I328NT',
ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe',
configsetroot: 'C:\\WINDOWS\\ConfigSetRoot',
FPS_BROWSER_APP_PROFILE_STRING: 'Internet Explorer',
FPS_BROWSER_USER_PROFILE_STRING: 'Default',
HOMEDRIVE: 'C:',
HOMEPATH: '\\Users\\dc5yy',
LOCALAPPDATA: 'C:\\Users\\dc5yy\\AppData\\Local',
LOGONSERVER: '\\\\DESKTOP-2I328NT',
MOZ_PLUGIN_PATH: 'C:\\Program Files (x86)\\Foxit Software\\Foxit Reader\\plugins\\',
NUMBER_OF_PROCESSORS: '4',
OneDrive: 'C:\\Users\\dc5yy\\OneDrive',
OS: 'Windows_NT',
Path: 'C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;D:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files (x86)\\VisualSVN Server\\bin;D:\\Program Files\\nodejs\\;C:\\Users\\dc5yy\\AppData\\Roaming\\npm;C:\\Users\\dc5yy\\AppData\\Local\\Microsoft\\WindowsApps;D:\\xampp\\apache\\bin',
PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
PROCESSOR_ARCHITECTURE: 'AMD64',
PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',
PROCESSOR_LEVEL: '6',
PROCESSOR_REVISION: '3c03',
ProgramData: 'C:\\ProgramData',
ProgramFiles: 'C:\\Program Files',
'ProgramFiles(x86)': 'C:\\Program Files (x86)',
ProgramW6432: 'C:\\Program Files',
PROMPT: '$P$G',
PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules',
PUBLIC: 'C:\\Users\\Public',
SESSIONNAME: 'Console',
SystemDrive: 'C:',
SystemRoot: 'C:\\WINDOWS',
TEMP: 'C:\\Users\\dc5yy\\AppData\\Local\\Temp',
TMP: 'C:\\Users\\dc5yy\\AppData\\Local\\Temp',
USERDOMAIN: 'DESKTOP-2I328NT',
USERDOMAIN_ROAMINGPROFILE: 'DESKTOP-2I328NT',
USERNAME: 'admin',
USERPROFILE: 'C:\\Users\\dc5yy',
VISUALSVN_SERVER: 'C:\\Program Files (x86)\\VisualSVN Server\\',
windir: 'C:\\WINDOWS' },
pid: 3864,
features:
{ debug: false,
uv: true,
ipv6: true,
tls_npn: true,
tls_sni: true,
tls_ocsp: true,
tls: true },
_needImmediateCallback: false,
execPath: 'D:\\Program Files\\nodejs\\node.exe',
debugPort: 5858,
_startProfilerIdleNotifier: [Function: _startProfilerIdleNotifier],
_stopProfilerIdleNotifier: [Function: _stopProfilerIdleNotifier],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
reallyExit: [Function: reallyExit],
abort: [Function: abort],
chdir: [Function: chdir],
cwd: [Function: cwd],
umask: [Function: umask],
_kill: [Function: _kill],
_debugProcess: [Function: _debugProcess],
_debugPause: [Function: _debugPause],
_debugEnd: [Function: _debugEnd],
hrtime: [Function: hrtime],
dlopen: [Function: dlopen],
uptime: [Function: uptime],
memoryUsage: [Function: memoryUsage],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_setupDomainUse: [Function: _setupDomainUse],
_events:
{ newListener: [Function],
removeListener: [Function],
SIGWINCH: [Object] },
_rawDebug: [Function],
_eventsCount: 3,
domain: null,
_maxListeners: undefined,
EventEmitter:
{ [Function: EventEmitter]
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: 10,
init: [Function],
listenerCount: [Function] },
_fatalException: [Function],
_exiting: false,
assert: [Function],
config: { target_defaults: [Object], variables: [Object] },
nextTick: [Function: nextTick],
_tickCallback: [Function: _tickCallback],
_tickDomainCallback: [Function: _tickDomainCallback],
stdout: [Getter],
stderr: [Getter],
stdin: [Getter],
openStdin: [Function],
exit: [Function],
kill: [Function],
mainModule:
Module {
id: '.',
exports: {},
parent: null,
filename: 'D:\\node\\context.js',
loaded: false,
children: [],
paths: [Object] } },
GLOBAL: [Circular],
root: [Circular],
Buffer:
{ [Function: Buffer]
poolSize: 8192,
from: [Function],
alloc: [Function],
allocUnsafe: [Function],
allocUnsafeSlow: [Function],
isBuffer: [Function: isBuffer],
compare: [Function: compare],
isEncoding: [Function],
concat: [Function],
byteLength: [Function: byteLength] },
clearImmediate: [Function],
clearInterval: [Function],
clearTimeout: [Function],
setImmediate: [Function],
setInterval: [Function],
setTimeout: [Function],
console: [Getter] } D:\node>
可见,此时 global对象中没有 words属性, 因此 输出 this.words 是 undefined.
--------------------------------------
3. 情况三: 构造函数中的this .
//3: 构造函数中的this function Pet(words)
{
this.words = words;
this.speak = function(){
console.log(this.words);
console.log(this);
console.log(this === cat);
}
} var cat = new Pet("miao,miao");
cat.speak();
构造函数中的this 指的是 这个构造函数的 一个 实例.
4: 通过 call 改变一个 函数中的this 的指代.
4-1: 字面量对象:
//1: call : 改变一个函数中的this的指代: var pet = {
words: '...',
speak: function(say){
console.log(say + ' ' + this.words);
}
}; pet.speak('Speak'); var dog = {
words: 'wang,wang'
}; pet.speak.call(dog, 'dog speaks'); console.log(dog); pet.speak('pet speak again');
运行:
pet.speak.call(dog, 'dog speaks');
显然:
1. dog 对象 没有 speak方法, 如果使用 dog.speak()报错.
2.pet.speak.call(dog, 'dog speaks');
这句话的意思是 pet.speak 方法 的 this 指代发生变更, 从 pet 对象, 改为 dog 对象;
同时 'dog speaks' 是给 pet.speak方法传递的参数.
3. 这里 pet.speak.call(dog, 'dog speaks'); 是 一次性的.
3-1: 从第 20行 ,可以看出this 又 指向了pet对象.
3-2: 从 18行可以看出, 使用call 将 pet.speak 中的this改变,从pet对象改为 dog 对象后.
dog对象 自己 并没有 增加 speak 方法.
仅仅只是 对象 可以 通过 call 调用 其他对象的方法, 同时将该方法中的this 指代 自己.
格式: 其他对象 . 方法 . call(当前对象, 传递给方法的参数);
------------------------------------------
//1: call : 改变一个函数中的this的指代: var pet = {
words: '...',
speak: function(say){
console.log(say + ' ' + this.words);
console.log(this === dog);
}
}; pet.speak('Speak'); var dog = {
words: 'wang,wang'
};
// dog.speak('dog, dog');
pet.speak.call(dog, 'dog speaks'); console.log(dog); // pet.speak('pet speak again');
4-2: 构造函数:
//1: call : 改变一个函数中的this的指代: //1-1: 字面量对象:
// var pet = {
// words: '...',
// speak: function(say){
// console.log(say + ' ' + this.words);
// console.log(this === dog);
// }
// }; // pet.speak('Speak'); // var dog = {
// words: 'wang,wang'
// };
// // dog.speak('dog, dog');
// pet.speak.call(dog, 'dog speaks'); // console.log(dog); // pet.speak('pet speak again'); //1-2: 构造函数
function Pet(words){
this.words = words;
this.speak = function(say){
console.log(say + ' : '+ this.words);
console.log(this === dog01);
};
} var pet01 = new Pet('this is pet');
pet01.speak('pet speak'); function Dog(words){
this.words = words;
} var dog01 = new Dog('this is dog'); pet01.speak.call(dog01, 'dog speak');
console.log(dog01);
5. 通过 call 实现继承.
//2: call: 实现继承: function Pet(words, age){
this.words = words;
this.age = age;
this.speak = function(say){
console.log(say + ' : '+ this.words);
};
} var pet = new Pet('this is pet', '4');
pet.speak('pet speaks');
console.log(pet); function Dog(words, age, color){
this.color = color;
Pet.call(this, words, age);
// Pet.apply(this, [words, age]);
} var dog = new Dog("this is dog", 2, 'yellow');
dog.speak('dog speaks');
console.log(dog);
运行:
注意:
1.Pet.call(this, words, age); 格式是 : 其他构造函数(被继承的构造函数) . call (this当前构造函数, 传递给 被继承的构造函数的参数).
2. call 和 apply的区别是 call 的参数是字符串, 多个, ; apply的参数是 一个数组.
3.通过 被继承构造函数 . call (继承的构造函数, 参数) 后 ,
继承的构造函数 就会 具有 被继承的构造函数中的 属性 和 方法.
参考链接:
JavaScript , js 上下文(this 的指代)的更多相关文章
- javascript(js)小数精度丢失的解决方案
原因:js按照2进制来处理小数的加减乘除,在arg1的基础上 将arg2的精度进行扩展或逆扩展匹配,所以会出现如下情况. javascript(js)的小数点加减乘除问题,是一个js的bug如0.3* ...
- 【转】关于URL编码/javascript/js url 编码/url的三个js编码函数
来源:http://www.cnblogs.com/huzi007/p/4174519.html 关于URL编码/javascript/js url 编码/url的三个js编码函数escape(),e ...
- paip.java 以及JavaScript (js) 的关系以及区别
paip.java 以及JavaScript (js) 的关系以及区别 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http:// ...
- 关于URL编码/javascript/js url 编码/url的三个js编码函数
关于URL编码/javascript/js url 编码/url的三个js编码函数escape(),encodeURI(),encodeURIComponent() 本文为您讲述关于js(javasc ...
- JavaScript js无间断滚动效果 scrollLeft方法 使用模板
JavaScript js无间断滚动效果 scrollLeft方法 使用模板 <!DOCTYPE HTML><html><head><meta charset ...
- JavaScript(js)/上
JavaScript(js) ECMA-----定义的基础语法 DOM------document object model BOM------Browser object model Jav ...
- 【HANA系列】SAP HANA XS使用JavaScript(JS)调用存储过程(Procedures)
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA XS使用Jav ...
- Atitit. Java script 多重多重catch语句的实现and Javascript js 异常机制
Atitit. Java script 多重多重catch语句的实现and Javascript js 异常机制 1. 语法错误(ERROR)和运行期错误(Exception) 1 2. 错误类型判断 ...
- atitit.javascript js 上传文件的本地预览
atitit.javascript js 上传文件的本地预览 1. .URL.createObjectURL 1 1.1. 吊销所有使用 URL.createObjectURL 而创建的 URL,以 ...
随机推荐
- Oracl 12c安装
Oracl安装部署 一.前置条件准备 修改hostname: hostname oracle 修改/etc/hosts:添加192.168.10.106 oracle 添加软件开发工具 搭建yum源 ...
- python基础之列表以及切片等操作
列表 定义: 能装对象的对象,列表能放大量的数据,各种类型,且列表内的数据是可以修改保存的,常用 [ ] 去表示,每一项数据之间用逗号隔开 1.列表的索引与切片 1.1 索引 与字符串的索引几乎一致, ...
- 迭代FFT
int reverse(int x, int len){ ; ; i < len; i <<= ){ t <<= ; ; } return t; } Complex A[ ...
- 第一阶段——站立会议总结DAY02
1.昨天做了什么:做出了一个大概的界面(APP的个人中心界面),有用户名信息和按钮. 2.今天准备做什么:因为仅是完成在页面上显示文字,而显示个人信息的化,想要做成微信的个人中心辣个样子. ①就是文字 ...
- 前端VUE框架-es6
EMCAScript 6 又叫 es2015 1.常量和变量 常量: const a = "hello" 常量不能修改和重复定义 变量: let:定义一个块级作用域的变量 需要先定 ...
- java利用jxl实现Excel导入功能
本次项目实践基于Spring+SpringMvc+MyBatis框架,简单实现了Excel模板导出.和Excel批量导入的功能.实现过程如下:. 1.maven导入所需jar包 <depende ...
- SpringBoot系列之jar包转war包
1.修改pom,将打包方式改为war包 2.dependencides中配置外部tomcat <!--因配置外部TOMCAT 而配置--> <dependency> <g ...
- ActiveMQ的spring配置文件
从官网copy出来,做了部分修改: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=& ...
- listener.ora和tnsnames.ora格式解析
listener.ora是oracle数据库服务端的监听配置文件,包括协议.IP地址和端口等内容:tnsnames.ora是oracle数据库客户端的连接配置文件,也是对应的协议.IP地址和端口等内容 ...
- hive top n
hive 中窗口函数row_number,rank,dense_ran,ntile分析函数的用法 hive中一般取top n时,row_number(),rank,dense_ran()这三个函数就派 ...