admin管理员组文章数量:1023794
I've the following javascript file:
onShowFunction = function(e){
//Some JQuery code
}
window.onpageshow(onShowFunction);
The index console log appears:
[Error] TypeError: window.onpageshow is not a function.
(In 'window.onpageshow(onShowFunction)', 'window.onpageshow' is null)
Global Code (scripts.js:58)
I don't understand how to resolve. Is that event defined in other way and it is not a function?
I've the following javascript file:
onShowFunction = function(e){
//Some JQuery code
}
window.onpageshow(onShowFunction);
The index console log appears:
[Error] TypeError: window.onpageshow is not a function.
(In 'window.onpageshow(onShowFunction)', 'window.onpageshow' is null)
Global Code (scripts.js:58)
I don't understand how to resolve. Is that event defined in other way and it is not a function?
Share Improve this question asked Mar 4, 2018 at 12:57 alessandro308alessandro308 2,1922 gold badges17 silver badges32 bronze badges 2-
window.onpageshow is not a function , mean you have to assign your created function to this window variable like
window.onpageshow = onShowFunction
– Bourbia Brahim Commented Mar 4, 2018 at 13:11 - 1 Read this – Mike Ezzati Commented Mar 4, 2018 at 13:47
2 Answers
Reset to default 5window.onpageshow is not default js function. Try this:
window.addEventListener('pageshow', function(event) {
console.log('pageshow:');
console.log(event);
});
In your case:
window.addEventListener('pageshow', onShowFunction);
Try this
window.addEventListener('pageshow', onShowFunction);
or
window.onpageshow = function(e) { //Some JQuery code }
or
<body onpageshow="onShowFunction(e)"></body>
I've the following javascript file:
onShowFunction = function(e){
//Some JQuery code
}
window.onpageshow(onShowFunction);
The index console log appears:
[Error] TypeError: window.onpageshow is not a function.
(In 'window.onpageshow(onShowFunction)', 'window.onpageshow' is null)
Global Code (scripts.js:58)
I don't understand how to resolve. Is that event defined in other way and it is not a function?
I've the following javascript file:
onShowFunction = function(e){
//Some JQuery code
}
window.onpageshow(onShowFunction);
The index console log appears:
[Error] TypeError: window.onpageshow is not a function.
(In 'window.onpageshow(onShowFunction)', 'window.onpageshow' is null)
Global Code (scripts.js:58)
I don't understand how to resolve. Is that event defined in other way and it is not a function?
Share Improve this question asked Mar 4, 2018 at 12:57 alessandro308alessandro308 2,1922 gold badges17 silver badges32 bronze badges 2-
window.onpageshow is not a function , mean you have to assign your created function to this window variable like
window.onpageshow = onShowFunction
– Bourbia Brahim Commented Mar 4, 2018 at 13:11 - 1 Read this – Mike Ezzati Commented Mar 4, 2018 at 13:47
2 Answers
Reset to default 5window.onpageshow is not default js function. Try this:
window.addEventListener('pageshow', function(event) {
console.log('pageshow:');
console.log(event);
});
In your case:
window.addEventListener('pageshow', onShowFunction);
Try this
window.addEventListener('pageshow', onShowFunction);
or
window.onpageshow = function(e) { //Some JQuery code }
or
<body onpageshow="onShowFunction(e)"></body>
本文标签: javascriptdocumentonpageshow is not a functionStack Overflow
版权声明:本文标题:javascript - document.onpageshow is not a function - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745578192a2157149.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论