jquery implements the ability to replace IFRAME

Source: Internet
Author: User

The original: jquery implements the function of the alternative IFRAME

The use of IFRAME can be well embedded in other Web pages or Web sites, but the IFRAME every time the load will be wasted a lot of time, and will prevent the loading of other elements, the search engine does not recognize the page Ifram frame called links, text, pictures and so on.

HTML code

<ul class= "List-side" > <li><a target= "a.html" >about</a></li> <li><a target= " B.html ">news</a></li> <li><a target=" c.html ">product</a></li> <li> <a href= "http://ucmic.blogspot.com/" target= "_blank" >contact</a></li></ul><div id= " iframe > <!--jquery Insert HTML address--></div>

JavaScript code to implement functionality

$ (document). Ready (function () {$.get ("a.html", function (data) {///initial a.html include Div#iframe $ ("#iframe"). HTML (data)  ; });  $ (function () {$ ('. List-side li '). Click (function () {  //) find the hyperlink in the Li href (#id) var $this = $ (this), _clicktab = $this. Find (' a '). attr (' target ');    Locate the value of Targer in Link a $.get (_clicktab,function (data) {$ ("#iframe"). HTML (data);  }); });});

  

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.