Jquery implements the same click. Two different links point to two different IFRAME

Source: Internet
Author: User

Recently I wrote two front-end pages of the management background, one of which is the management background. The left-side menu navigation and the right-side content page are two IFRAME pages. The requirement is that when you click the leading flight above, IFRAME on the left and IFRAME on the right call different links. I personally recommend using jquery for implementation,CodeConcise and highly scalable.
Jquery section:

Function Gotourl ( Url_a , Url_ B )
{
$ ( ' # Ifr_a ' ) . Get ( 0 ) . SRC = Url_a ;
$ ( ' # Ifr_ B ' ) . Get ( 0 ) . SRC = Url_ B ;
}

HTML call:

< A Href = " Javascript: void (0) " Onclick = " Gotourl ('HTTP: // g.cn/', 'http://baidu.com '); " > Click here. The content of the two IFRAME files will change. </ A >
< IFRAME SRC = " Http://mrthink.net/ " ID = " Ifr_a " Name = " Ifr_a " Frameborder = " 0 " > </ IFRAME >
< IFRAME SRC = " Http://mrthink.net/ " ID = " Ifr_ B " Name = " Ifr_ B " Frameborder = " 0 " > </ IFRAME >

You can use js to determine the iframe id and assign different SRC values to different IDs, but the code is a little more complicated.

 

Mr. Think's blog: http://mrthink.net/javascript-jquery-twourl-twoifram/

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.