如何通过编写一个页面代码来关闭esc key pres上的modelpopup? [英] How to close modelpopups on esc key pres by writing one page code ?

查看:67
本文介绍了如何通过编写一个页面代码来关闭esc key pres上的modelpopup?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





Hi ,

<script type="text/javascript">
        document.onkeyup = function (e) {
            var keycode;
            if (window.event)
                keycode = window.event.keyCode;
            else if (e)
                keycode = e.which;
            if (keycode == 27) {
                if ($find("ContentPlaceHolder1_mpForHoliday")) {
                    $find("ContentPlaceHolder1_mpForHoliday").hide();
                }
            }
        }

    </script>







我正在每个页面上编写这个脚本以关闭esc键上的modelpoups ..但是无论如何我可以通过将这个脚本放在单页上来获得这个功能..例如母版页等等。




I am writing this script on each page for closing the modelpoups on esc key .. but is their anyway where i can get this functionlity by placing this script on single page .. such as master page and so ..

推荐答案

find(ContentPlaceHolder1_mpForHoliday)){
find("ContentPlaceHolder1_mpForHoliday")) {


find(ContentPlaceHolder1_mpForHoliday)。hide();
}
}
}

< /脚本 >
find("ContentPlaceHolder1_mpForHoliday").hide(); } } } </script>







我正在每个页面上编写这个脚本以关闭esc键上的modelpoups ..但是无论如何我可以通过将这个脚本放在单页上来获得这个功能..例如母版页等等。




I am writing this script on each page for closing the modelpoups on esc key .. but is their anyway where i can get this functionlity by placing this script on single page .. such as master page and so ..


是的,只需将其写入一个文件并保存为.js(JavaScript文件),称为外部js文件,并在每个页面中包含该文件。



如果您有母版页,那么只需在该页面中包含该外部js文件即可。它将自动反映在继承该页面的所有子页面中,
Yes just write this inside one file and save it as .js (JavaScript file), which is called External js file and include that in every page.

If you have a Master Page, then just include that External js file in that page. Automatically it will reflect in all the child pages inheriting that,


这篇关于如何通过编写一个页面代码来关闭esc key pres上的modelpopup?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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