无法在 IFrame 中访问手风琴
我将 jQuery 的手风琴与 DotNetNuke 一起使用。 现在DNN页面是动态加载到IFrame中的,所以包含IFrame的页面的Page_load事件,IFrame还没有被填充。
<div class="dvFrame">
<iframe class="IFrame" marginheight="0" marginwidth="0" frameborder="0" runat="server" id="frmDNN" ></iframe>
</div>
在 page_load 中:
frmDNN.Attributes.Add("src", ConfigurationManager.AppSettings["dnn"] + request);
加载到 IFrame 中的手风琴:
<div id="accordion">
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
</div>
<div>
<h3><a href="#">Second</a></h3>
<div>Phasellus mattis tincidunt nibh.</div>
</div>
</div>
现在有了一些 Javascript,我应该能够说 div 应该像手风琴一样工作。 但每次尝试,我似乎都失败了。
$("#accordion").accordion({ header: "h3" });
有人可以帮助我解决这个问题,我将不胜感激。
I am using the accordion from jQuery together with DotNetNuke.
Now the DNN page is loaded into an IFrame dynamicly, so the Page_load event of the page which includes the IFrame, the IFrame is not filled yet.
<div class="dvFrame">
<iframe class="IFrame" marginheight="0" marginwidth="0" frameborder="0" runat="server" id="frmDNN" ></iframe>
</div>
In the page_load:
frmDNN.Attributes.Add("src", ConfigurationManager.AppSettings["dnn"] + request);
The accordion that is loaded into the IFrame:
<div id="accordion">
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.</div>
</div>
<div>
<h3><a href="#">Second</a></h3>
<div>Phasellus mattis tincidunt nibh.</div>
</div>
</div>
Now with some Javascript I should be able to say that the div should act like an accordion.
But with every attempt, I seem to fail.
$("#accordion").accordion({ header: "h3" });
Can someone help me with this problem, it would be highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对 DotNetNuke 不太了解,但我认为如果您在主页中定义 Accordion javascript 并在 iFrame 中定义 Accordion HTML,您可能需要将 javascript 更改为:
I don't know much about DotNetNuke, but I think if you're defining the Accordion javascript in the main page and the accordion HTML in the iFrame you may need to change the javascript to: