简体   繁体   English

HTML CSS:iframe /动态问题

[英]HTML CSS: Iframes/Dynamic Problem

I am having some trouble creating a experimental 'dynamic' style website. 我在创建实验性“动态”风格的网站时遇到了一些麻烦。 The site is set up as follows. 该站点设置如下。 The user has a menu of links to choose from, specifically using an image map. 用户有一个链接菜单可供选择,特别是使用图像地图。 When they hover over a selection, an iframe pops up (becomes visible) displaying some data. 当他们将鼠标悬停在选择上时,iframe会弹出(变为可见)以显示一些数据。 When the user removes the mouse the iframe goes away, until the user hovers over another link. 当用户移开鼠标时,iframe消失,直到用户将鼠标悬停在另一个链接上。

-- It seems to be working well, but only intermittently. -似乎运作良好,但只是断断续续。 Sometimes after leaving one of the anchors, the syle, text etc. still occupies the frame even after i hover over another link. 有时,在离开锚点之一之后,即使我将鼠标悬停在另一个链接上之后,样式,文本等仍然占据框架。 This behavior seems to be fairly random, but there must be a way to fix it. 这种现象似乎是相当随机的,但是必须有一种解决方法。

Here's an example of what i'm using. 这是我正在使用的示例。 The show function sets the frame to visible if the argument is a 1, and hidden if 0. frameset sets the main frame to the desired html document. 如果参数为1,则show函数将框架设置为可见;如果参数为0,则将其隐藏。frameset将主框架设置为所需的html文档。 I tried implementing a reset to set the frame to something blank after leaving the link to try and fix it, but the problem persists. 我尝试执行重置以将框架设置为空白,然后留下链接尝试对其进行修复,但是问题仍然存在。

<area shape="circle" coords="..." href="..." onmouseover="Show('frame', 1);
frameset('page.html');" onmouseout="Show('frame', 0); reset();" />

And the functions 和功能

function frameset(a)
{
  document.all.frame.src=a;
}

function reset()
{
  document.all.frame.src=blank.html;
}

It's a very hard problem to describe, so let me know if more information or code is needed. 这是一个很难描述的问题,所以让我知道是否需要更多信息或代码。 Any better alternatives to my method are also welcome, considering i'm not fluent in javascript :) Thank you 考虑到我不太精通javascript,也欢迎使用任何更好的方法替代我的方法:)谢谢

I think what you are doing could be performed better by using a more modern approach. 我认为,使用更现代的方法可以更好地执行您的操作。

The image map could have absolutely positioned block level anchor tags.. but this doesn't seem to be the problem. 图像映射可能具有绝对定位的块级锚标记。.但这似乎不是问题。

Instead of using iframes, I'd recommend using AJAX to get the information and a framework like jQuery to help you display the data. 建议不要使用iframe,而建议使用AJAX获取信息,并建议使用jQuery之类的框架来帮助您显示数据。

You could load the AJAX and display the box with a loading throbber ( http://www.ajaxload.info ) on mouseover, and parse the data into viewable format inside the div. 您可以在鼠标悬停时加载AJAX并显示带有加载项的框( http://www.ajaxload.info ),然后将数据解析为div内的可见格式。

Learning AJAX 学习AJAX

AJAX is when a page makes a http request to the server and can also return data which is then used with Javascript to update the DOM. AJAX是指页面向服务器发出http请求,还可以返回数据,然后将其与Javascript一起使用以更新DOM。

jQuery is a Javascript framework designed to abstract away browser specific code and inconsistencies and just make using Javascript a better experience. jQuery是一个Javascript框架,旨在抽象化浏览器特定的代码和不一致之处,并且使使用Javascript带来更好的体验。

Check out jQuery's AJAX functions 查看jQuery的AJAX函数

Good luck!! 祝好运!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM