Asp.net default enter button settings

巴扎黑
Release: 2016-12-20 15:53:44
Original
1422 people have browsed it

Actually, I have been exposed to how to set the default enter button on the asp.net page early on, but I didn't record it at the time. I encountered it again today. I couldn't find it after searching through the information, and I couldn't solve it according to the methods on the Internet. It was so painful.

I believe everyone knows the online method. It’s nothing more than setting the following js code on the aspx page:

                                                                                                                                                                                               if (event.keyCode == 13) {
                                                                                                                                                                                               But this code for me, if the button is an ImageButton , this code can be used; if the button is a Button, this code will not work. I tried it for a long time without success, and I was very puzzled. Later, I took a look online and saw a question about button id. Then I was thinking, is there something wrong with the button ID? The id must have changed after being compiled.

                                                                                                            Finally, I used the browser to browse the page where the default enter button needs to be set, checked the source code, found the id of the button, copied it, it is a long section, similar to ctl00_ContentPlaceHolder1_Button1, replaced this with the button id in the js code, and ran Page, press Enter, it’s normal.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!