通过JavaScript编写HTML页面的Object标签?

编程入门 行业动态 更新时间:2024-10-19 20:31:55
本文介绍了通过JavaScript编写HTML页面的Object标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

通过JavaScript编写HTML页面的对象标签? 我已经使用iFrames和Objects将网页加载到另一个页面。 我想要做类似但不加载uri,而是写页面,< HTML> ....到...< / HTML>通过JavaScript函数。 这两个标签中的任何一个都可以吗? 谢谢, gsb

解决方案

" gsb" < gs*@QWest>写道:

通过JavaScript写HTML页面的对象标签? 我已经使用iFrames和Objects将网页加载到另一个页面。 />我想做类似但不加载uri,而是写页面,< HTML> ...到...< / HTML>通过JavaScript函数。这两个标签中的任何一个都可以吗?

使用iframe。 --- < iframe id =" foo" name =" foo">< / iframe> < script type =" text / javascript"> 函数writeDoc() { var doc = frames [''foo'']。document; doc.open(); doc.write(" ;<!DOCTYPE ...>< html> ....有趣的内容!< / html>"); doc.close(); } < / script> < input type =" button"值= QUOT;插入" onclick =" writeDoc()"> --- 在IE 6,Mozilla FB和Opera 7中测试过。 Mozilla是一个需要iframe上的name属性 才能通过框架集合访问它。 / L - Lasse Reichstein Nielsen - lr*@hotpop DHTML死亡颜色:< URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> ''没有判断的信仰只会降低精神神圣。''

这对一个对象或只是一个iFrame有效吗? 再次感谢, gsb " Lasse Reichstein Nielsen" < lr*@hotpop>在消息中写道 news:oe ********** @ hotpop ...

" gsb" < gs*@QWest>写道:

通过JavaScript写HTML页面的对象标签? 我已经使用iFrames和Objects将网页加载到另一个页面。 />我想做类似但不加载uri,而是写页面,< HTML> ...到...< / HTML>通过JavaScript函数。这两个标签中的任何一个都可以吗?使用iframe。 --- < iframe id =" foo" name =" foo">< / iframe> < script type =" text / javascript"> 函数writeDoc(){ var doc = frames [''foo'']。document; doc.open(); doc.write("<!DOCTYPE ...>< html> ....有趣的内容!< / html>"); doc.close(); } < / script> < input type =" button"值= QUOT;插入" onclick =" writeDoc()"> --- 在IE 6,Mozilla FB和Opera 7中测试过。 Mozilla需要iframe上的name属性通过框架集合访问它。 / L - Lasse Reichstein Nielsen - lr*@hotpop DHTML死亡颜色:

< URL:http://www.infimum.dk/HTML/rasterTriangleDOM。 HTML> 没有判断的信仰只会降低精神神圣。

" gsb" < gs*@QWest>写道: 请不要发帖。

这对一个对象,还是仅仅是一个iFrame?

可能只有iframe。它通过帧集合访问嵌入页面的文档对象 。 我对物体没有多少经验,但我的印象是 嵌入了object标签的页面不容易访问 通过脚本编写 - 因为该对象可以容纳这么多不同的b / b 类型的数据,那里是不是简单的方法来访问 那里的数据。 / L - Lasse Reichstein Nielsen - lr*@hotpop DHTML死亡颜色:< URL:http:/ /www.infimum.dk/HTML/rasterTriangleDOM.html> ''没有判断的信仰只会降低精神神圣。''

Object tag to write HTML page to via JavaScript? I''ve used iFrames and Objects to load web pages into another page. I want to do similar but not load a uri, rather write the page, <HTML> ....to...</HTML> via a JavaScript function. Is this possible with either of these two tags? Thanks, gsb

解决方案

"gsb" <gs*@QWest> writes:

Object tag to write HTML page to via JavaScript? I''ve used iFrames and Objects to load web pages into another page. I want to do similar but not load a uri, rather write the page, <HTML> ...to...</HTML> via a JavaScript function. Is this possible with either of these two tags?

Use an iframe. --- <iframe id="foo" name="foo"></iframe> <script type="text/javascript"> function writeDoc() { var doc = frames[''foo''].document; doc.open(); doc.write("<!DOCTYPE ... ><html> ....funny content! </html>"); doc.close(); } </script> <input type="button" value="insert" onclick="writeDoc()"> --- Tested in IE 6, Mozilla FB and Opera 7. Mozilla is the one that requires the name attribute on the iframe in order to access it through the frames collection. /L -- Lasse Reichstein Nielsen - lr*@hotpop DHTML Death Colors: <URL:www.infimum.dk/HTML/rasterTriangleDOM.html> ''Faith without judgement merely degrades the spirit divine.''

Does that work with an object, or just an iFrame? Thanks again, gsb "Lasse Reichstein Nielsen" <lr*@hotpop> wrote in message news:oe**********@hotpop...

"gsb" <gs*@QWest> writes:

Object tag to write HTML page to via JavaScript? I''ve used iFrames and Objects to load web pages into another page. I want to do similar but not load a uri, rather write the page, <HTML> ...to...</HTML> via a JavaScript function. Is this possible with either of these two tags? Use an iframe. --- <iframe id="foo" name="foo"></iframe> <script type="text/javascript"> function writeDoc() { var doc = frames[''foo''].document; doc.open(); doc.write("<!DOCTYPE ... ><html> ....funny content! </html>"); doc.close(); } </script> <input type="button" value="insert" onclick="writeDoc()"> --- Tested in IE 6, Mozilla FB and Opera 7. Mozilla is the one that requires the name attribute on the iframe in order to access it through the frames collection. /L -- Lasse Reichstein Nielsen - lr*@hotpop DHTML Death Colors:

<URL:www.infimum.dk/HTML/rasterTriangleDOM.html> ''Faith without judgement merely degrades the spirit divine.''

"gsb" <gs*@QWest> writes: Please don''t top post.

Does that work with an object, or just an iFrame?

Probably only with iframes. It accesses the document object of the embedded page throught the frames collection. I don''t have much experience with objects, but my impression is that pages embedded with the object tag are not easily accessible through scripting - because the object can hold so many different types of data, there is no simple way to access the data that is there. /L -- Lasse Reichstein Nielsen - lr*@hotpop DHTML Death Colors: <URL:www.infimum.dk/HTML/rasterTriangleDOM.html> ''Faith without judgement merely degrades the spirit divine.''

更多推荐

通过JavaScript编写HTML页面的Object标签?

本文发布于:2023-10-08 01:33:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471125.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   标签   JavaScript   HTML   Object

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!