jquery implements the same click, two different links, pointing to two different IFrame

Source: Internet
Author: User

Recently wrote two admin backend front page, there is a management background, the left menu navigation and the right content page is two iframe, the demand is, click on the main navigation, left IFrame and the right IFRAME call different links. Personal recommendation with jquery implementation, code concise, strong scalability .
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 '); point my two iframe contents 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

Through JS to determine the ID of the IFRAME, and then give different ID different SRC value can also be implemented, but the code is relatively complex.

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.