如何检查用户是否在控制台中输入了某些内容?Javascript [英] How to check if the user enters something in the console? Javascript

查看:46
本文介绍了如何检查用户是否在控制台中输入了某些内容?Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查用户是否在控制台中输入了某些内容?我希望每当用户在控制台中输入内容时运行一个函数,例如

function whenUserTypesInConsole() {alert('你在控制台输入了一些东西');}

如果可以的话,有没有办法检查用户输入的内容

function whenUserTypesInConsole(entry) {alert('你在控制台中输入了' + entry + ');}

如果可能,我想避免使用 jQuery 或任何库.

谢谢

解决方案

这里有一篇关于这个的文章,肯定会帮助你,但如果你能解释你想在哪里以及为什么要使用它.帮助你会更容易

https://blog.guya.net/chrome/dev_tools/>

How could one check if the user enters something in the console? I want a function to run whenever a user enters something in the console, say

function whenUserTypesInConsole() {
    alert('you entered something in the console');
}

and if that can be done, is there a way to check what the user entered

function whenUserTypesInConsole(entry) {
    alert('you entered ' + entry + ' in the console');
}

I would like to avoid using jQuery or any library if possible.

Thanks

解决方案

well here is article on this, will help you for sure, but if you can explain where and why you want to use this. It will be more easier to help you

https://blog.guya.net/chrome/dev_tools/

这篇关于如何检查用户是否在控制台中输入了某些内容?Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆