点击按钮即可切换iframe?

时间:2018-06-22 06:12:58

标签: jquery html button iframe

我有3个iframe,现在我想在单击按钮时制作3个按钮,它将更改iframe

这是我的代码

<button value="iframe 1" target="myiframe"></button>
<button value="iframe 2" target="myiframe"></button>
<button value="iframe 3" target="myiframe"></button>

<iframe name="myiframe"></iframe>

这好吗?我不知道是否所有3个iframe都会加载一次?  我只想在页面加载时先加载iframe 1,而不是iframe 2和3。 如果有更好的代码,请帮助我。

1 个答案:

答案 0 :(得分:0)

尝试

def build_absolute_uri(request, location, protocol=None):
    from .account import app_settings as account_settings

    if request is None:
        site = Site.objects.get_current()
        bits = urlsplit(location)
        if not (bits.scheme and bits.netloc):
            uri = '{proto}://{domain}{url}'.format(
                proto=account_settings.DEFAULT_HTTP_PROTOCOL,
                domain=site.domain,
                url=location)
        else:
            uri = location
    else:
        uri = request.build_absolute_uri(location)
    # NOTE: We only force a protocol if we are instructed to do so
    # (via the `protocol` parameter, or, if the default is set to
    # HTTPS. The latter keeps compatibility with the debatable use
    # case of running your site under both HTTP and HTTPS, where one
    # would want to make sure HTTPS links end up in password reset
    # mails even while they were initiated on an HTTP password reset
    # form.
    if not protocol and account_settings.DEFAULT_HTTP_PROTOCOL == 'https':
        protocol = account_settings.DEFAULT_HTTP_PROTOCOL
    # (end NOTE)
    if protocol:
        uri = protocol + ':' + uri.partition(':')[2]
    return uri

*注意:请根据需要更改data-src和src属性。