框架集中嵌入式HTML - 是否可能? [英] Embedded HTML in frameset - is it possible?

查看:42
本文介绍了框架集中嵌入式HTML - 是否可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在FRAMESET中嵌入HTML代码?像

这样的东西:


< frameset cols =" 50%,*">

< frame SRC =" ...框架的HTML代码...">

< frame src =" Frame2.html" name =" main">

< / frameset>< noframes>< / noframes>


我尝试使用返回的Javascript函数HTML文本,如下面代码中的




<!doctype html public" - // w3c // dtd html 4.0 transitional // en">

< html>

< head> < title>第1帧< / title>

< script type =" text / javascript">

function myFunction()

{

return(<!doctype html public \" - // w3c // dtd html 4.0 transitional // en \">

< html>

< head>

< title>第1帧< / title>

< / head>

< body>

< H2>第1帧< / H2>

< / body>

< ; / html>

")

}

< / script>

< / head>

< frameset cols =" 50%,*">

< frame src = myFunction()name =" toc">

< frame src =" Frame2.html" name =" main">

< / frameset>< noframes>< / noframes>

< / html>

但浏览器显示页面无法显示第一个

框架。


我试图找到一种从Java servlet生成页面的方法

包含一个隐藏的(0宽度)框架和一个完全可见的框架,其中包含一些

的动态内容。


我将欣赏任何线索。


Alex Molochnikov

解决方案

首先,设置跟进是一种用途。发布到多个

新闻组时。 [后续设置。]


Alex Molochnikov写道:

有没有办法在FRAMESET中嵌入HTML代码?像
这样的东西:

< frameset cols =" 50%,*">
< frame src =" ...帧的HTML代码...">
< frame src =" Frame2.html" name =" main">
< / frameset>< noframes>< / noframes>




很多人(包括我自己)都建议丢弃CSS的帧。框架

有许多缺点,没有支撑优势。

http://www.html-faq.com/htmlframes/?framesareevil


-

Ben M.





Alex Molochnikov写道:

有什么办法吗?将HTML代码嵌入到FRAMESET中?
< frameset cols =" 50%,*">
< frame src = myFunction()name =" toc">



你可以使用

< frame src =" javascript :parent.myFunction()" name =" toc">

如果你确保myFunction返回一个包含HTML但是

课程的字符串,那么只有当浏览器支持JavaScript并且

用户已启用它,所以在网上一般来说这不是一个好的

想法,即使你想使用框架。

And即便如此,在某些浏览器中也存在问题,例如Opera 7,例如,
可能会在交叉框架时为您提供访问被拒绝的错误或类似内容。
后来使用
脚本。


如果你真的想用脚本设置框架内容那么更安全

有一个函数写入该框架,例如

函数initFrame( ){

var frameDoc = window.frames.toc;

frameDoc.document.open();

frameDoc.document.write(' 'html在这里'');

frameDoc.document.close();

}


< frameset onload = " initFrame();" ...>

< frame src =" fallback.html" name =" toc">


-


Martin Honnen
http://JavaScript.FAQTs.com/


Alex Molochnikov写道:

有没有办法在FRAMESET中嵌入HTML代码?


No.


[snip]

我正试图找到一种方法来生成一个页面Java servlet,它将包含一个隐藏的(0宽度)框架和一个带有一些动态内容的完全可见的框架。




目的框架(通常被它们的b $ b缺陷和缺点大大超过)是显示来自多个文档的内容。

如果你不想这样做,为什么你使用框架吗?什么是

意味着进入这个隐藏的框架?


Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>

I tried using a Javascript function that returns the HTML text, as in the
following code:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head> <title>Frame 1</title>
<script type="text/javascript">
function myFunction()
{
return ("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">
<html>
<head>
<title>Frame 1</title>
</head>
<body>
<H2>Frame 1</H2>
</body>
</html>
")
}
</script>
</head>
<frameset cols="50%,*">
<frame src=myFunction() name="toc">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>
</html>

but the browser shows the "The page cannot be displayed" for the first
frame.

I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.

I will appreciate any clues.

Alex Molochnikov

解决方案

Firstly, it''s usenetiquette to set a "Followup" when posting to multiple
newsgroups. [Followup set.]

Alex Molochnikov wrote:

Is there any way to embed the HTML code inside FRAMESET? Something like
this:

<frameset cols="50%,*">
<frame src=" ... HTML code for the frame ... ">
<frame src="Frame2.html" name="main">
</frameset><noframes></noframes>



Many people (including myself) recommend dropping frames for CSS. Frames
have many disadvantages with no supporting advantage.

http://www.html-faq.com/htmlframes/?framesareevil

--
Ben M.




Alex Molochnikov wrote:

Is there any way to embed the HTML code inside FRAMESET?
<frameset cols="50%,*">
<frame src=myFunction() name="toc">



You can use
<frame src="javascript:parent.myFunction()" name="toc">
if you make sure that myFunction returns a string with HTML but of
course that will only work then if the browser supports JavaScript and
the user has it enabled so on the web in general that is not a good
idea, even if you want to use frames.
And even then there are issues in some browsers, Opera 7 for instance
might give you access denied errors or similar when cross frame
scripting is used later.

If you really want to set the frame content with script then it is safer
to have a function write to that frame e.g.
function initFrame () {
var frameDoc = window.frames.toc;
frameDoc.document.open();
frameDoc.document.write(''html goes here'');
frameDoc.document.close();
}

<frameset onload="initFrame();" ...>
<frame src="fallback.html" name="toc">

--

Martin Honnen
http://JavaScript.FAQTs.com/


Alex Molochnikov wrote:

Is there any way to embed the HTML code inside FRAMESET?
No.

[snip]
I am trying to find a way to generate a page from the Java servlet that
would contain a hidden (0-width) frame and a fully visible frame with some
dynamic content.



The purpose of frames (which is generally vastly outweighed by their
flaws and disadvantages) is to display content from multiple documents.
If you don''t want to do that, why are you using frames at all? What is
meant to go in this "hidden" frame?


这篇关于框架集中嵌入式HTML - 是否可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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