Framename of the Target attribute in HTML

Source: Internet
Author: User

Tags that contain the target attribute include: <A> <form> <base> <area>.

The corresponding target values include:

_ Blank

_ Parent

_ Self

_ Top

Framename (the <area> tag does not exist)

For the above four, I am not familiar with it anymore. But few people noticed or used the fifth value: framename. Because it is designed so cleverly...

Here is an example of an asynchronous Ajax login method.

However, most logons cannot be performed using Ajax for the simple reason: Cross-origin and insecure. However, many requirements require asynchronous implementation without refresh. The following is the answer.

A form, corresponding to the target:

<Form action = "http://reg.domain.com/login" method = "Post" target = "hidden_iframe"> <input type = "text" name = "user"/> <input type = "password" Name = "password"/> <button type = "Submit"> logon </button> </form>

An iframe, corresponding name

<iframe style="display:none" frameborder="0" scrolling="no" name="hidden_iframe"></iframe>

In this way, when you click log on, the form will be submitted in the IFRAME below without refreshing the page.

Then, the system checks whether a user logs on through cookies. The following is a JS example:

/** Cyclically determine whether the user has logged on. Set the timeout time for 3 seconds. If the user name or password is not displayed within 3 seconds * @ callback: <function> callback function, determine whether the user logs on and executes */function dologin (callback) {var COUNT = 0, Timer = setinterval (function () {If (islogined () {clearinterval (timer ); callback & callback (); return;} // 3 s enouglif (++ count> 15) {alert ('user name or Password error! '); Clearinterval (timer) ;}}, 200) ;}/ * determine by Cookie */function islogined () {If (...) {.. the processing of a large push cookie is omitted here .. return true;} return false ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.