从菜单中单击链接时需要显示iframe [英] Need to display iframe when link is clicked from menu

查看:106
本文介绍了从菜单中单击链接时需要显示iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,该网站可以显示我在8tracks上创建的一堆播放列表.假设我有10个播放列表;我希望能够通过以下方式链接到该iframe播放列表(通过8tracks提供的嵌入代码): http://d.pr/i/FBxn

I am creating a website which can display a bunch of playlists I have created on 8tracks. Lets say I have 10 playlists; I want to be able to link to that iframe playlist (via the embed code which 8tracks provides) like this: http://d.pr/i/FBxn

基本上,我希望根据点击菜单上的混音带链接(播放列表的播放列表*)来更改iframe

Essentially I want the iframe to change based on which mixtape link I click on the menu (a playlist of playlists*)

我是JS新手,不胜感激.我仍在尝试掌握HTML和JS之间的关系,因此这对我来说是一个新领域.非常感谢.

I am new to JS and would appreciate anyhelp. I'm still trying to grasp the relationship between HTML and JS so this is a new area for me. Thanks so much.

推荐答案

您可以设置锚点以定位特定的iframe:

You can setup anchors to target a specific iframe:

为iframe(播放框架)命名,并将"src"设置为默认播放列表(呈现iframe时显示)

Give a name to your iframe (playframe), and set the 'src' to the default playlist (displayed when iframe is rendered)

<iframe name='playframe' src='http://path/to/playlist/1'></iframe>

然后将您的链接定位到播放框架

Then target your links to playframe

<a href='http://path/to/playlist/1' target='playframe'>Playlist 1</a>​
<a href='http://path/to/playlist/2' target='playframe'>Playlist 2</a>​

这篇关于从菜单中单击链接时需要显示iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆