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
When you learn MySQL, you will find that it comes...
Result: html <nav id="nav-1"> <...
1. Modify the firewall settings and open the corr...
Preface Recently, I found a pitfall in upgrading ...
Table of contents Manual deployment 1. Create a s...
CSS background image flickering bug in IE6 (backg...
In this system, the # sign represents the root us...
Recently, we need to perform a scheduled migratio...
Preface As we all know, by default, the MySQL ins...
Vue $set array collection object assignment In th...
This article shares the specific code of Vue to i...
Table of contents 1. Offline installation 2. Onli...
Solution: Just set the link's target attribute...
Mind Map He probably looks like this: Most of the...
Whether it is the background image or the text siz...