Better alternative to an iframe?

前端 未结 8 1614
臣服心动
臣服心动 2020-12-05 03:20

I have a page with an iframe to feature the contents of the clicked tab. There are 3 tabs and 1 iframe. The sources of the contents relating to each tab clicked are formatte

8条回答
  •  半阙折子戏
    2020-12-05 03:26

    There's an alternative to AJAX!

    You can load ALL three possible contents into separate DIVs.

    Then clicking on a tab will simply make the display attribute of the appropriate content's DIV "block" while making the other two DIVs' display property "none".

    Cheap, easy, does not require AJAX costs for extra http request or for coding.

    Mind you, AJAX is a better solution if the contents of the tabs will change dynamically based on other data as opposed to being known at the time the page loads.

提交回复
热议问题