| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1126 人关注过本帖
标题:javascript里innerHTML元素替换无效
只看楼主 加入收藏
zyx55017
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2010-7-20
结帖率:66.67%
收藏
已结贴  问题点数:20 回复次数:2 
javascript里innerHTML元素替换无效
<html>
<head>
<title>测试</title>
<script type="text/javascript">
function s02()
{
document.getElementById("sp").innerHTML="
<embed
type='application/x-shockwave-flash' src='http://player.' id='movie_player' name='movie_player'
bgcolor='#FFFFFF'
quality='high'
allowfullscreen='true' flashvars='isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false
&UserID=&winType=interior&playMovie=true&MM
Control=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3
007,3008,9999'
pluginspage='http://www.'
width='640' height='550'>
</embed>";
}
</script>
</head>

<body>
<div class="dy" id="sp">
  <embed
type="application/x-shockwave-flash"
src="http://player.
id="movie_player"
name="movie_player"
bgcolor="#FFFFFF"
quality="high"
allowfullscreen="true"
flashvars="isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false
&UserID=&winType=interior&playMovie=true&MM
Control=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3
007,3008,9999"
pluginspage="http://www.
width="640"
height="550"> </embed>
</div>

<a href="#" onClick="s02()">第02集</a>
</body>
</html>

这个网页里,有一个视频,和一个按钮。

按第02集时,就应该会改变<embed>整块元素,显示另一个视频。

但是,我点了半天都没反应,不知道出了什么问题,希望高人指点一点,到底哪里出错了? 我都把双引改成单引了,还是不行啊?
搜索更多相关主题的帖子: innerHTML javascript 元素 
2010-07-20 12:53
zmh886
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:238
专家分:1305
注 册:2010-6-2
收藏
得分:20 
<html>
<head>
<title>测试</title>
<script type="text/javascript">
function s02()
{
document.getElementById("sp").innerHTML="<embed type='application/x-shockwave-flash' src='http://player.' id='movie_player' name='movie_player' bgcolor='#FFFFFF' quality='high' allowfullscreen='true' flashvars='isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false&UserID=&winType=interior&playMovie=true&MM Control=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3007,3008,9999' pluginspage='http://www.' width='640' height='550'></embed>";
}
</script>
</head>

<body>
<div class="dy" id="sp">
  <embed
type="application/x-shockwave-flash"
src="http://player.
id="movie_player"
name="movie_player"
bgcolor="#FFFFFF"
quality="high"
allowfullscreen="true"
flashvars="isShowRelatedVideo=false&showAd=0&show_pre=1&show_next=1&isAutoPlay=false&isDebug=false
&UserID=&winType=interior&playMovie=true&MM
Control=false&MMout=false&RecordCode=1001,1002,1003,1004,1005,1006,2001,3001,3002,3003,3004,3005,3
007,3008,9999"
pluginspage="http://www.
width="640"
height="550"> </embed>
</div>

<a href="#" onClick="s02()">第02集</a>
</body>
</html>

http://www./
2010-07-20 21:19
zyx55017
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2010-7-20
收藏
得分:0 
谢谢,终于可以了。
2010-07-22 08:19
快速回复:javascript里innerHTML元素替换无效
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.075099 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved