任何在HTML5中使用框架的方法? [英] Any way of using frames in HTML5?

查看:116
本文介绍了任何在HTML5中使用框架的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于学校我必须建立一个网站,它必须使用那些糟糕的旧的fml帧。我已经向我的老师抱怨没有任何成功:($ / b>

我想使用HTML5,但似乎帧已被弃用。我真的需要使用XHTML或HTML 4?是否有一些解决方法使得我的网页使用框架验证HTML5?

现在,那里有很多例子,我会以散文的方式回答问题,说明为什么以下验证规则很重要。我也曾经说过,有时候你必须成为一名反叛者,打破规则,并记录原因。

你可以在这个例子中看到框架集仍然可以在HTML5中工作,但我不得不下载代码并在顶部添加HTML5文档类型,但框架元素仍然可以识别,并且达到了预期的效果。



因此,知道使用框架集是完全荒谬的,并且知道这一点您必须按照您的教授/老师的说法来使用它,您可以在W3C验证程序中处理单个验证错误,并使用HTML5视频元素以及弃用的frameset元素。

 <!DOCTYPE html> 
< html>
< head>
< / head>
<! - frameset在html5中不推荐使用,但它仍然有效。 - >
< frameset framespacing =0rows =150,*frameborder =0noresize>
< frame name =topsrc =http://www.npscripts.com/framer/demo-top.htmltarget =top>
< frame name =mainsrc =http://www.google.comtarget =main>
< / frameset>
< / html>

请记住,如果这是一个适合学校的项目,最有可能不会是一旦浏览器供应商完全删除了对HTML5的框架集支持,即可在一两年内完成。只要知道你是对的,只要做你的老师/教授就可以获得的成绩就可以了:)

更新:



顶层父文档使用XHTML,框架使用HTML5。验证者没有抱怨框架集是非法的,也没有抱怨视频元素。



index.php

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Frameset // ENhttp:// www。 w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\"> 
< html>
< head>
< / head>
< frameset framespacing =0rows =150,*frameborder =0noresize>
< frame name =topsrc =http://www.npscripts.com/framer/demo-top.htmltarget =top>
< frame name =mainsrc =video.htmltarget =main>
< / frameset>
< / html>

video.html

 <!doctype html> 
< html>
< head>
< / head>
< body>
< div id =player-container>
< div class =arrow>< / div>
< div class =player>

< video id =vid1width =480height =267
poster =http://cdn.kaltura.org/apis/html5lib/kplayer-examples /media/bbb480.jpg
durationHint =33controls>
< source src =http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb_trailer_iphone.m4v/>

< source src =http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb400p.ogv/>

< / video>

< / div>
< / body>
< / html>


For school I must make a website and it must use those crappy old damn fml frames. I've already complained about this to my teacher without any success :(

I want to use HTML5, but it seems that frames are deprecated. Am I really required to use XHTML or HTML 4? Is there some work-around that makes my pages validate HTML5 with use of frames?

解决方案

Now, there are plenty of example of me answering questions with essays on why following validation rules are important. I've also said that sometimes you just have to be a rebel and break the rules, and document the reasons.

You can see in this example that framesets do work in HTML5 still. I had to download the code and add an HTML5 doctype at the top, however. But the frameset element was still recognized, and the desired result was achieved.

Therefore, knowing that using framesets is completely absurd, and knowing that you have to use this as dictated by your professor/teacher, you could just deal with the single validation error in the W3C validator and use both the HTML5 video element as well as the deprecated frameset element.

<!DOCTYPE html>
<html>
    <head>
    </head>
    <!-- frameset is deprecated in html5, but it still works. -->
    <frameset framespacing="0" rows="150,*" frameborder="0" noresize>
        <frame name="top" src="http://www.npscripts.com/framer/demo-top.html" target="top">
        <frame name="main" src="http://www.google.com" target="main">
    </frameset>
</html>

Keep in mind that if it's a project for school, it's most likely not going to be something that will be around in a year or two once the browser vendors remove frameset support for HTML5 completely. Just know that you are right and just do what your teacher/professor asks just to get the grade :)

UPDATE:

The toplevel parent doc uses XHTML and the frame uses HTML5. The validator did not complain about the frameset being illegal, and it didn't complain about the video element.

index.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
    <head>
    </head>
    <frameset framespacing="0" rows="150,*" frameborder="0" noresize>
        <frame name="top" src="http://www.npscripts.com/framer/demo-top.html" target="top">
        <frame name="main" src="video.html" target="main">
    </frameset>
</html>

video.html:

<!doctype html>
<html>
    <head>
    </head>
    <body>
        <div id="player-container">
            <div class="arrow"></div>
            <div class="player">

                <video id="vid1" width="480" height="267" 
                    poster="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb480.jpg"
                    durationHint="33" controls>
                    <source src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb_trailer_iphone.m4v" />

                    <source src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb400p.ogv" />

                </video>

        </div>
    </body>
</html>

这篇关于任何在HTML5中使用框架的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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