HTML页面加载外部框架 [英] HTML page loads external frame

查看:70
本文介绍了HTML页面加载外部框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一个菜单和一个iFrame的主页面。

根据菜单上的选择,在iFrame中加载了一个不同的html页面

。菜单只是< a href = ...>

的列表,即用户按下第一个按钮。菜单上的键,然后第一页

被加载到框架内。


在这里找到我使用的页面的示例。


index.html

================================ ==========

< html>

< body>

<! - 这里的菜单 - - >

< iframe src =" first.htm">< / iframe>

< / body>

< / html>

===================================== =====


first.html

====================== ====================

< p>

Hello world

< / p>

===================================== =====


这是我的问题。我希望当有人在浏览器中输入

地址栏时,地址为 www.mysite.com/first.html ,然后只需加载first.htm而不是

。 l文件,我想看到整个

" index.html"页面和first.html在iFrame中加载的文件。

有可能吗?我怎么能这样做?

提前谢谢你。


Mario Jannelli
www.silverino.com

解决方案

< blockquote> Silver写道:

这是我的问题。我希望当有人在浏览器中输入
地址栏时,地址为 www.mysite。 com / first.html ,然后只加载first.htm而不是
。 l文件,我想看整个
index.html页面和first.html文件加载到iFrame中。
有可能吗?







-

David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>

主页是〜/ .bashrc的位置


David Dorward写道2006年6月20日在comp.lang.javascript

Silver写道:

这是我的问题。我希望当有人在浏览器中输入
地址栏时,地址为 www.mysite。 com / first.html ,然后只加载first.htm而不是
。 l文件,我想看整个
index.html页面和first.html文件加载到iFrame中。
有可能吗?






是[如果之间的差异。 htm和.html是一个错字]

=============在first.html =============


< script type =''text / javascript''>

if(self == top)location.href =''index.html?f = first index.html中的.html''

< / script>


============= ==== =========


按location.hash选择f =文件名并加载iframe。


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)


Evertjan。写道:

David Dorward于2006年6月20日在comp.lang.javascript中写道

Silver写道:

这是我的问题。我希望当有人在浏览器中输入
地址栏时,地址为 www.mysite。 com / first.html ,然后只加载first.htm而不是
。 l文件,我想看整个
index.html页面和first.html文件加载到iFrame中。
有可能吗?




是[如果.htm和.html之间的差异是拼写错误]

=============在first.html中=============

<脚本类型=''text / javascript''>
if(self == top)location.href =''index.html?f = first.html''
< / script>

=============在index.html中=============

按位置选择f =文件名.hash并加载iframe。




最好用服务器端做,而不是依靠JavaScript


索引。 php?f = first.html


这是一个令人讨厌的框架,(包括iframe),我想

,以防止框架突然出现一个非JavaScript的解决方案将在.htacess文件中重写




-

小心,


Jonathan

-------------------

LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


I have a main page that includes one menu and one iFrame.
Depending on the selections made on a menu, a different html page is
loaded inside the iFrame. The menu is just a list of <a href=...>

i.e. The user presses the "first" key on the menu, then the first page
is loaded inside the frame.

Find here a sample for the pages I use.

index.html
==========================================
<html>
<body>
<!-- menu here -->
<iframe src="first.htm"></iframe>
</body>
</html>
==========================================

first.html
==========================================
<p>
Hello world
</p>
==========================================

Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible? How can I do in order to do it?
Thank you much in advance.

Mario Jannelli
www.silverino.com

解决方案

Silver wrote:

Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible?



No

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


David Dorward wrote on 20 jun 2006 in comp.lang.javascript:

Silver wrote:

Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible?



No



Yes [if the diference between .htm and .html is a typo]
============= in first.html =============

<script type=''text/javascript''>
if (self == top) location.href=''index.html?f=first.html''
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


Evertjan. wrote:

David Dorward wrote on 20 jun 2006 in comp.lang.javascript:

Silver wrote:

Here is my question. I want that when someone types in the browser
addressbar the address www.mysite.com/first.html, then instead of
loading just the "first.htm" l file, I want to see the entire
"index.html" page and the "first.html" file loaded inside the iFrame.
Is it possible?


No



Yes [if the diference between .htm and .html is a typo]
============= in first.html =============

<script type=''text/javascript''>
if (self == top) location.href=''index.html?f=first.html''
</script>

============= in index.html =============

select the f=filename by location.hash and load the iframe.



Better to do it with server-side and not depend on JavaScript

index.php?f=first.html

It is one of the nasty bit with frames, (iframes included) and I guess
to prevent breaking out of frames a non-javascript solution would be a
rewrite in the .htacess file.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


这篇关于HTML页面加载外部框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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