admin管理员组文章数量:1391947
I want to run a javascript function from the browser console,
I'm trying to do it in Chrome (windows 7) and my function is this:
function playVideo() {
var popo = document.getElementsByTagName("object");
for (var i=0; i<popo.length; i++) {
popo[i].playVideo();
}
}
normally this function works fine when I fire it from a webpage
<button onclick="playVideo();">play</button>
or
<a href="javascript:playVideo();">play</a>
but if I paste it into the browser console, and I press Return,
it doesn't work and there is this error:
"undefined"
.jpg
What i'm doing wrong?
I want to run a javascript function from the browser console,
I'm trying to do it in Chrome (windows 7) and my function is this:
function playVideo() {
var popo = document.getElementsByTagName("object");
for (var i=0; i<popo.length; i++) {
popo[i].playVideo();
}
}
normally this function works fine when I fire it from a webpage
<button onclick="playVideo();">play</button>
or
<a href="javascript:playVideo();">play</a>
but if I paste it into the browser console, and I press Return,
it doesn't work and there is this error:
"undefined"
http://oi57.tinypic./z1hjc.jpg
What i'm doing wrong?
- you just defined a function. Call it. – Benjamin Gruenbaum Commented Mar 22, 2014 at 23:39
- I've tried to call it, but without success.. I don't understand why... – user3443329 Commented Mar 23, 2014 at 12:54
1 Answer
Reset to default 1After paste to console and pressing return you must call this function by name, in you case, after "undefined" write to consle "playVideo()" and press Return.
本文标签: chromerun javascript function from browser console quotundefinedquotStack Overflow
版权声明:本文标题:chrome - run javascript function from browser console "undefined" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744746792a2622931.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论