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.