1: If you use the tag <a> to link to a page, I believe everyone knows the role of the target attribute. It refers to the form in which the linked page is displayed. Commonly used values of target are: _blank (open the linked page in a new pop-up browser window) and _self (open the linked page in the original window). Of course, there are also _top and so on, but since they are not commonly used, I will not introduce them here. For example: <a href="http://jb51.net" target="_blank">123WORDPRESS.COM </a> means to link to 123WORDPRESS.COM and open it in a new window 2: If you use the tag <a> to trigger an action (after the action is completed, you usually jump to a certain page). This action can be divided into two types here: (1) Actions that do not submit a form (i.e., actions that do not operate on the form). Relevant scenarios in web development, such as deleting a single record, are not very complicated, and do not require many parameters, all of which are submitted in get mode. At this time, you can specify the display format of the page to be jumped to through the target attribute. The usage here is the same as described in 1. for example <a href="http://jb51.net/user/deleteAction.do?id=5" target="_self">Delete Xiao Ming</a> means that after the action is processed, a new page will be opened in this window. (2) The action of submitting in the form of a form (i.e., the action of submitting the data in the form). Such applications are common in web development, such as user registration, information modification, etc. Of course, some people will say that the data in the form can be submitted directly using <input type="submit"> or <input type="button">. But in some cases, you may prefer to submit in the form of <a href="javascript:your js function name">. If you submit it in the form of a tag <a>, and you want to use the attribute target to control the page to jump to after processing, it will not work. At this time, the target attribute is no longer effective. Instead, you should set it in the target attribute of the form to achieve what you want! for example: Copy code The code is as follows:function check(){ //Verify that it is not empty if(form1.username.value=""){ return; } form1.submit(); } <form action="http://china.com/user/addAction.do" target="_blank" name="form1"> <input type="text" name="username" > </form> <a href="javascript:check();" target="_self">Submit</a> Indicates that after the action is processed, a new page is opened in a new window. (Although the target attribute of the tag <a> is set here, it will not take effect; instead, the target attribute of the form will take effect). |
<<: A brief discussion on CSS blocking merging and other effects
>>: Docker sets up port mapping, but cannot access the solution
js interesting countdown case, for your reference...
The two parameters innodb_flush_log_at_trx_commit...
HTML form tag tutorial, this section mainly expla...
As we all know, mailto is a very practical HTML ta...
Preface In WeChat applet development (native wxml...
Editor's note: This article is contributed by...
Specify in CSS style file #class td /*Set the tab...
Copy code The code is as follows: height:auto !im...
The Spring Boot project uses docker containers, j...
After installing VMware Tools, ① text can be copi...
JS running trilogy js running code is divided int...
Introduction After compiling, installing and solv...
The installation of MySQL 5.7 on Ubuntu 1804 is i...
yum quick install mysql Add yum repository rpm -U...
1. Download and install Download the community ed...