使用document.body.innnerHTML属性丢失的问题 innerHTML浏览器会解析,不符合DOM关系的全部会被去掉,要保留什么东西得具体写下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 像情况一,可能不知道用户指定了什么属性。所以具体写也有难度。有可能是realplay对象,还有可能是其它的。 <html xmlns="http://www.w3.org/1999/xhtml"><head><title>test</title><script type="text/javascript">function test() { var content = document.body.innerHTML; document.body.innerHTML = content; MediaPlayer.ShowStatusBar=true; MediaPlayer.Filename="http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3"}</script></head><body onload="test()"><object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=300 height=50><param name=ShowStatusBar value=-1><param name=Filename value=http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src="http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3" width=300 height=50></embed></object></body></html>情况一我是这样解决的,可是有的时候连MediaPlayer这个对象的ID都不知道 如何用innerHTML中的javascript代码执行?问题如下,当执行t()方法时,iframe会变为不可编辑,如果将body内的js脚本复制到t()方法中,可以使iframe变为可编辑。现在的问题是,不知道body会执行什么js代码,请问能不能不用复制js代码的方法解决这个问题?<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>test</title><style type="text/css">td.TableBody2{background-color: #E4E8EF;}.tableBorder1{width:98%;border: 1px; background-color: #6595D6;}</style><script type="text/javascript">function t() { document.body.innerHTML = document.body.innerHTML;}</script></head><body onload="t()"><iframe id="Composition" width="450" height="300"></iframe><script type="text/javascript">var IsIE5 = document.all;if (IsIE5){ var IframeID = frames["Composition"];} else { var IframeID = document.getElementById("Composition").contentWindow;}var editor = IframeID;editor.document.open();editor.document.write ('<html><head>');editor.document.write ("</head><body></body>");editor.document.write ("</html>");editor.document.close();editor.document.body.contentEditable = "True";</script></body></html> js方法调用问题 新手问题:Ext中分页无显示 问个下拉表的问题 js可以调用外部iframe的值吗? 动态增加javascript脚本的问题 导航菜单问题 Javascript在IE与FireFox中的兼容性问题求教高手 如何从A网站传递一个值给B网站?,内详 100分求:JavaScript 精美菜单!! 又是javascript在ie和netscript 中的区别……, 紧急! 求一个javascripr代码 作用是 文本框的值改变后自动提交 不需要鼠标操作 跪求!像csdn首页那种javascript的图片变换效果源码!谢谢
<head>
<title>
test
</title>
<script type="text/javascript">
function test() {
var content = document.body.innerHTML;
document.body.innerHTML = content;
MediaPlayer.ShowStatusBar=true;
MediaPlayer.Filename="http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3"
}
</script>
</head>
<body onload="test()">
<object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=300 height=50>
<param name=ShowStatusBar value=-1>
<param name=Filename value=http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3>
<embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src="http://www.liaozhong.cn/tp/news/200612/20061231356243392.mp3" width=300 height=50></embed></object>
</body>
</html>
情况一我是这样解决的,可是有的时候连MediaPlayer这个对象的ID都不知道
问题如下,当执行t()方法时,iframe会变为不可编辑,如果将body内的js脚本复制到t()方法中,可以使iframe变为可编辑。现在的问题是,不知道body会执行什么js代码,请问能不能不用复制js代码的方法解决这个问题?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<style type="text/css">
td.TableBody2{background-color: #E4E8EF;}
.tableBorder1{width:98%;border: 1px; background-color: #6595D6;}
</style>
<script type="text/javascript">
function t() {
document.body.innerHTML = document.body.innerHTML;
}
</script>
</head>
<body onload="t()">
<iframe id="Composition" width="450" height="300"></iframe>
<script type="text/javascript">
var IsIE5 = document.all;
if (IsIE5)
{
var IframeID = frames["Composition"];
} else {
var IframeID = document.getElementById("Composition").contentWindow;
}
var editor = IframeID;
editor.document.open();
editor.document.write ('<html><head>');
editor.document.write ("</head><body></body>");
editor.document.write ("</html>");
editor.document.close();
editor.document.body.contentEditable = "True";
</script>
</body>
</html>